diff mbox series

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

Message ID 20200924001920.43594-1-john.p.donnelly@oracle.com (mailing list archive)
State Accepted
Headers show
Series scsi: page warning: 'page' may be used uninitialized | expand

Commit Message

John Donnelly Sept. 24, 2020, 12:19 a.m. UTC
From: John Donnelly <john.p.donnelly@oracle.com>

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: linux-scsi@vger.kernel.org
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mike Christie Oct. 2, 2020, 6:01 p.m. UTC | #1
On 9/23/20 7:19 PM, john.p.donnelly@oracle.com wrote:
> From: John Donnelly <john.p.donnelly@oracle.com>
> 
> 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: linux-scsi@vger.kernel.org
> Cc: Mike Christie <michael.christie@oracle.com>
> Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
> ---
>  drivers/target/target_core_user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 9b7592350502..86b28117787e 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -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.

Acked-by: Mike Christie <michael.christie@oracle.com>
John Donnelly Oct. 2, 2020, 6:08 p.m. UTC | #2
> On Oct 2, 2020, at 1:01 PM, Mike Christie <michael.christie@oracle.com> wrote:
> 
> On 9/23/20 7:19 PM, john.p.donnelly@oracle.com wrote:
>> From: John Donnelly <john.p.donnelly@oracle.com>
>> 
>> 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: linux-scsi@vger.kernel.org
>> Cc: Mike Christie <michael.christie@oracle.com>
>> Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
>> ---
>> drivers/target/target_core_user.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
>> index 9b7592350502..86b28117787e 100644
>> --- a/drivers/target/target_core_user.c
>> +++ b/drivers/target/target_core_user.c
>> @@ -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.
> 
> Acked-by: Mike Christie <michael.christie@oracle.com>


Hi 

Thank you.

I am not always on the email dlists .. Please do the right thing .
Martin K. Petersen Oct. 3, 2020, 1:23 a.m. UTC | #3
John,

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

Applied to 5.10/scsi-staging, thanks!
Martin K. Petersen Oct. 7, 2020, 3:47 a.m. UTC | #4
On Wed, 23 Sep 2020 17:19:20 -0700, john.p.donnelly@oracle.com 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
diff mbox series

Patch

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 9b7592350502..86b28117787e 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -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;