Re: [PATCH 1/5] Fix potential null pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>> @@ -388,8 +388,10 @@ sysfs_get_tgt_nodename(struct path *pp, char *node)
>>  		if (value && !strcmp(value, "usb")) {
>>  			pp->sg_id.proto_id = SCSI_PROTOCOL_USB;
>>  			tgtname = udev_device_get_sysname(tgtdev);
>> -			strlcpy(node, tgtname, NODE_NAME_SIZE);
>> -			return 0;
>> +			if (!tgtname) {
> 
> I assume that you mean "if (tgtname)"
> 

Thanks for your correction. I'm will correct it.

>> +				strlcpy(node, tgtname, NODE_NAME_SIZE);
>> +				return 0;
>> +			}
>>  		}
>>  		tgtdev = udev_device_get_parent(tgtdev);
>>  	}
>> diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
>> index d40c0869..f778410a 100644
>> --- a/libmultipath/foreign/nvme.c
>> +++ b/libmultipath/foreign/nvme.c
>> @@ -184,7 +184,9 @@ static int snprint_nvme_map(const struct gen_multipath *gmp,
>>  							      "firmware_rev"));
>>  	case 'r':
>>  		val = udev_device_get_sysattr_value(nvm->udev, "ro");
>> -		if (val[0] == 1)
>> +		if (!val)
>> +			return -1;
> 
> sprint_ro() returns "undef" for a similar case. Perhaps we should do
> that here as well.
> 

I'll do it here and send v2 patch. Thanks again.


Regards,
Lixiaokeng

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux