Re: [PATCH] SCSI core: always store >= 36 bytes of INQUIRY data

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

 



Alan Stern wrote:
> +	int copy_len;
...
> +	copy_len = max((int) sdev->inquiry_len, 36);
> +	sdev->inquiry = kmalloc(copy_len, GFP_ATOMIC);
>  	if (sdev->inquiry == NULL) {
>  		return SCSI_SCAN_NO_RESPONSE;
>  	}
...
> +	memcpy(sdev->inquiry, inq_result, copy_len);
...

Can be written slightly more concise:

	sdev->inquiry = kmemdup(inq_result,
				max_t(size_t, sdev->inquiry_len, 36),
				GFP_ATOMIC);
	if (sdev->inquiry == NULL)
		return SCSI_SCAN_NO_RESPONSE;

This is untested. kmemdup is only available since 2.6.19-rc1.
-- 
Stefan Richter
-=====-=-==- =-=- ====-
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux