kernel/drivers/scsi/scsi.c
.. .. @@ -317,11 +317,18 @@ 317 317 if (result) 318 318 return -EIO; 319 319 320 - /* Sanity check that we got the page back that we asked for */320 + /*321 + * Sanity check that we got the page back that we asked for and that322 + * the page size is not 0.323 + */321 324 if (buffer[1] != page) 322 325 return -EIO; 323 326 324 - return get_unaligned_be16(&buffer[2]) + 4;327 + result = get_unaligned_be16(&buffer[2]);328 + if (!result)329 + return -EIO;330 +331 + return result + 4;325 332 } 326 333 327 334 /**