User: | Jiri Slaby |
Error type: | Invalid Pointer Dereference |
Error type description: | A pointer which is invalid is being dereferenced |
File location: | drivers/scsi/scsi_lib.c |
Line in file: | 2149 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2011-11-07 22:22:22 UTC |
2119 * @sdev: scsi device to change the state of. 2120 * @timeout: command timeout 2121 * @retries: number of retries before failing 2122 * @sshdr_external: Optional pointer to struct scsi_sense_hdr for 2123 * returning sense. Make sure that this is cleared before passing 2124 * in. 2125 * 2126 * Returns zero if unsuccessful or an error if TUR failed. For 2127 * removable media, a return of NOT_READY or UNIT_ATTENTION is 2128 * translated to success, with the ->changed flag updated. 2129 **/ 2130int 2131scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, 2132 struct scsi_sense_hdr *sshdr_external) 2133{ 2134 char cmd[] = { 2135 TEST_UNIT_READY, 0, 0, 0, 0, 0, 2136 }; 2137 struct scsi_sense_hdr *sshdr; 2138 int result; 2139 2140 if (!sshdr_external) 2141 sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL); 2142 else 2143 sshdr = sshdr_external; 2144 2145 /* try to eat the UNIT_ATTENTION if there are enough retries */ 2146 do { 2147 result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, 2148 timeout, retries); 2149 if (sdev->removable && scsi_sense_valid(sshdr) && 2150 sshdr->sense_key == UNIT_ATTENTION) 2151 sdev->changed = 1; 2152 } while (scsi_sense_valid(sshdr) && 2153 sshdr->sense_key == UNIT_ATTENTION && --retries); 2154 2155 if (!sshdr) 2156 /* could not allocate sense buffer, so can't process it */ 2157 return result; 2158 2159 if (sdev->removable && scsi_sense_valid(sshdr) &&