[lvc-project] [PATCH v1] scsi/cxgbi/libcxgbi: make sure sg is present before calling sg_next()
Daniil Tatianin
d-tatianin at yandex-team.ru
Mon Nov 14 13:12:58 MSK 2022
sg_next() dereferences the passed sg, therefore we have to verify that
it's present before calling it.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Signed-off-by: Daniil Tatianin <d-tatianin at yandex-team.ru>
---
drivers/scsi/cxgbi/libcxgbi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 506b561670af..1f8e93337602 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -1196,8 +1196,8 @@ void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *ppod,
if (offset == len) {
offset = 0;
- sg = sg_next(sg);
if (sg) {
+ sg = sg_next(sg);
addr = sg_dma_address(sg);
len = sg_dma_len(sg);
}
--
2.25.1
More information about the lvc-project
mailing list