[Libvirt-cim] [PATCH 1/4] libxkutil: Fix possible NULL dereferences
Eduardo Lima (Etrunko)
eblima at linux.vnet.ibm.com
Fri Jan 13 18:46:57 UTC 2012
On 01/13/2012 04:36 PM, Eduardo Lima (Etrunko) wrote:
[snip]
> diff --git a/src/Virt_Device.c b/src/Virt_Device.c
> index fd11370..96797a4 100644
> --- a/src/Virt_Device.c
> +++ b/src/Virt_Device.c
> @@ -102,6 +102,13 @@ static CMPIInstance *net_instance(const CMPIBroker *broker,
> "NetworkPort",
> ns);
>
> + if (inst == NULL) {
> + cu_statusf(broker, &s,
> + CMPI_RC_ERR_FAILED,
> + "Failed to get instance for NetworkPort");
> + return NULL;
> + }
> +
> if (!net_set_type(inst, dev))
> return NULL;
>
> @@ -135,6 +142,13 @@ static CMPIInstance *disk_instance(const CMPIBroker *broker,
> "LogicalDisk",
> ns);
>
> + if (inst == NULL) {
> + cu_statusf(broker, &s,
> + CMPI_RC_ERR_FAILED,
> + "Failed to get instance for LogicalDisk");
> + return NULL;
> + }
> +
> if (!disk_set_name(inst, dev))
> return NULL;
>
> @@ -177,6 +191,13 @@ static CMPIInstance *mem_instance(const CMPIBroker *broker,
> "Memory",
> ns);
>
> + if (inst == NULL) {
> + cu_statusf(broker, &s,
> + CMPI_RC_ERR_FAILED,
> + "Failed to get instance for Memory");
> + return NULL;
> + }
> +
> if (!mem_set_size(inst, dev))
> return NULL;
>
> @@ -221,6 +242,13 @@ static CMPIInstance *graphics_instance(const CMPIBroker *broker,
> "DisplayController",
> ns);
>
> + if (inst == NULL) {
> + cu_statusf(broker, &s,
> + CMPI_RC_ERR_FAILED,
> + "Failed to get instance for DisplayController");
> + return NULL;
> + }
> +
> if (!graphics_set_attr(inst, dev))
> return NULL;
>
Woops, this patch does not compiles. Sorry about that. I'm sending a new
version of the series.
Cheers,
--
Eduardo de Barros Lima
Software Engineer, Open Virtualization
Linux Technology Center - IBM/Brazil
eblima at br.ibm.com
More information about the Libvirt-cim
mailing list