Re: [PATCHv2] Add EVPD page 0x83 entries to sysfs

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

 



On Mon, Feb 10, 2014 at 12:11:39PM +0100, Hannes Reinecke wrote:
> +	int vpd_len = 255;
> +	unsigned char *buffer;
> +retry:
> +	buffer = kmalloc(vpd_len, GFP_KERNEL);
> +	if (!buffer)
> +		return;
> +
> +	ret = scsi_get_vpd_page(sdev, 0x83, buffer, vpd_len);
> +	if (ret) {
> +		kfree(buffer);
> +		return;
> +	}
> +
> +	vpd_len = (buffer[2] << 8) + buffer[3];
> +	if (vpd_len > 255) {
> +		kfree(buffer);
> +		goto retry;

Won't this create an infinite loop if the VPD is longer than 255 bytes?

--
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