Repository navigation
Commit 77dd7d7
scsi: lpfc: Fix less-than-zero comparison of unsigned value
The expression start_idx - dbg_cnt is evaluated using unsigned int
arthithmetic (since these variables are unsigned ints) and hence can never
be less than zero, so the less than comparison is never true. Rewrite the
expression to check for start_idx being less than dbg_cnt.
After the logic was corrected, temp_idx wasn't working correctly. So fix it
as well.
Link: https://lore.kernel.org/r/20200706204246.130416-1-jsmart2021@gmail.com
Fixes: 372c187 ("scsi: lpfc: Add an internal trace log buffer")
CC: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Unsigned compared against 0")1 parent 17105d9 commit 77dd7d7
1 file changed
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14161 | 14161 | | |
14162 | 14162 | | |
14163 | 14163 | | |
14164 | | - | |
| 14164 | + | |
14165 | 14165 | | |
14166 | | - | |
14167 | | - | |
| 14166 | + | |
14168 | 14167 | | |
14169 | | - | |
14170 | 14168 | | |
14171 | 14169 | | |
14172 | 14170 | | |
14173 | 14171 | | |
14174 | 14172 | | |
14175 | 14173 | | |
14176 | 14174 | | |
14177 | | - | |
| 14175 | + | |
14178 | 14176 | | |
14179 | 14177 | | |
14180 | 14178 | | |
| |||
0 commit comments