Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 161058
b: refs/heads/master
c: 95a3639
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Aug 22, 2009
1 parent ba69d09 commit 10be7ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5f91bb050ecc4ff1d8d3d07edbe550c8f431c5e1
refs/heads/master: 95a3639e275fb7aec5c9a2116c88a2cdd23e0b8b
13 changes: 7 additions & 6 deletions trunk/drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
* all the existing users tried this hard.
*/
result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer,
len + 4, NULL, 30 * HZ, 3, NULL);
len, NULL, 30 * HZ, 3, NULL);
if (result)
return result;

Expand All @@ -1021,13 +1021,14 @@ unsigned char *scsi_get_vpd_page(struct scsi_device *sdev, u8 page)
{
int i, result;
unsigned int len;
unsigned char *buf = kmalloc(259, GFP_KERNEL);
const unsigned int init_vpd_len = 255;
unsigned char *buf = kmalloc(init_vpd_len, GFP_KERNEL);

if (!buf)
return NULL;

/* Ask for all the pages supported by this device */
result = scsi_vpd_inquiry(sdev, buf, 0, 255);
result = scsi_vpd_inquiry(sdev, buf, 0, init_vpd_len);
if (result)
goto fail;

Expand All @@ -1050,12 +1051,12 @@ unsigned char *scsi_get_vpd_page(struct scsi_device *sdev, u8 page)
* Some pages are longer than 255 bytes. The actual length of
* the page is returned in the header.
*/
len = (buf[2] << 8) | buf[3];
if (len <= 255)
len = ((buf[2] << 8) | buf[3]) + 4;
if (len <= init_vpd_len)
return buf;

kfree(buf);
buf = kmalloc(len + 4, GFP_KERNEL);
buf = kmalloc(len, GFP_KERNEL);
result = scsi_vpd_inquiry(sdev, buf, page, len);
if (result)
goto fail;
Expand Down

0 comments on commit 10be7ff

Please sign in to comment.