Skip to contentSkip to conversation

scsi: page warning: 'page' may be used uninitialized

PATCH Applied [email protected] 3 participants 5 messages Sep 24, 2020 – Oct 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: page warning: 'page' may be used uninitialized

From: John Donnelly <[email protected]>

corrects: drivers/target/target_core_user.c:688:6: warning: 'page' may be used uninitialized

Fixes 3c58f737231e ("scsi: target: tcmu: Optimize use of

flush_dcache_page")

To: [email protected]

---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_user.c +1 -1
index 9b7592350502..86b28117787e 100644
@@ -681,7 +681,7 @@ static void scatter_data_area(struct tcmu_dev *udev,
 	void *from, *to = NULL;
 	size_t copy_bytes, to_offset, offset;
 	struct scatterlist *sg;
-	struct page *page;
+	struct page *page = NULL;
 
 	for_each_sg(data_sg, sg, data_nents, i) {
 		int sg_remaining = sg->length;
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · On 9/23/20 7:19 PM, [email protected] wrote:

From: John Donnelly <[email protected]>

corrects: drivers/target/target_core_user.c:688:6: warning: 'page' may be used uninitialized

Fixes 3c58f737231e ("scsi: target: tcmu: Optimize use of

flush_dcache_page")

To: [email protected]

---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_user.c +0 -0
index 9b7592350502..86b28117787e 100644

drivers/target/target_core_user.c static void scatter_data_area(struct tcmu_dev *udev, · line 687

Quoted 8 lines
drivers/target/target_core_user.c +1 -1
@@ -681,7 +681,7 @@ static void scatter_data_area(struct tcmu_dev *udev,
 	void *from, *to = NULL;
 	size_t copy_bytes, to_offset, offset;
 	struct scatterlist *sg;
-	struct page *page;
+	struct page *page = NULL;
 
 	for_each_sg(data_sg, sg, data_nents, i) {
 		int sg_remaining = sg->length;

Looks ok for now. In the next kernel we can do the more invasive approach and add a new struct/helpers to make the code cleaner and fix it properly.

#2 lore raw
Quoted 31 lines · Mike Christie
Quoted 26 lines · On 9/23/20 7:19 PM, [email protected] wrote:

From: John Donnelly <[email protected]>

corrects: drivers/target/target_core_user.c:688:6: warning: 'page' may be used uninitialized

Fixes 3c58f737231e ("scsi: target: tcmu: Optimize use of

flush_dcache_page")

To: [email protected]

---
drivers/target/target_core_user.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_user.c +1 -1
index 9b7592350502..86b28117787e 100644
@@ -681,7 +681,7 @@ static void scatter_data_area(struct tcmu_dev *udev,
 	void *from, *to = NULL;
 	size_t copy_bytes, to_offset, offset;
 	struct scatterlist *sg;
-	struct page *page;
+	struct page *page = NULL;
 
Quoted 8 lines

drivers/target/target_core_user.c static void scatter_data_area(struct tcmu_dev *udev, · line 687

Quoted 3 lines
drivers/target/target_core_user.c +0 -0
 	for_each_sg(data_sg, sg, data_nents, i) {
 		int sg_remaining = sg->length;

Looks ok for now. In the next kernel we can do the more invasive approach and add a new struct/helpers to make the code cleaner and fix it properly.

Hi

Thank you.

I am not always on the email dlists .. Please do the right thing .

#3 lore raw
In reply to [email protected]

John,

Quoted 2 lines

corrects: drivers/target/target_core_user.c:688:6: warning: 'page' may be used uninitialized

Applied to 5.10/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw
In reply to [email protected]
Quoted 5 lines · On Wed, 23 Sep 2020 17:19:20 -0700, [email protected] wrote:

corrects: drivers/target/target_core_user.c:688:6: warning: 'page' may be used uninitialized

Fixes 3c58f737231e ("scsi: target: tcmu: Optimize use of

flush_dcache_page")

Applied to 5.10/scsi-queue, thanks!

[1/1] scsi: target: tcmu: Fix warning: 'page' may be used uninitialized

      https://git.kernel.org/mkp/scsi/c/61741d8699e1
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering