Re: [PATCH] Fix null pointer error after vmbus loading

From: Greg KH
Date: Wed Oct 21 2009 - 18:45:36 EST


On Wed, Oct 21, 2009 at 07:24:23PM +0000, Haiyang Zhang wrote:
> From: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
>
> Fix null pointer error after vmbus loading.
>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> Signed-off-by: Hank Janssen <hjanssen@xxxxxxxxxxxxx>
> Signed-off-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
>
> ---
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index 582318f..11431cc 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -538,9 +538,10 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
> child_device_ctx);
>
> /* Make sure we are not registered already */
> - if (strlen(dev_name(&child_device_ctx->device)) != 0) {
> + if (dev_name(&child_device_ctx->device) != NULL &&
> + strlen(dev_name(&child_device_ctx->device)) != 0) {

Why would the device name ever be NULL? Why would you need to check it
here?

confused,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/