dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm-pcache: fix uninitialized variable issue
@ 2025-08-15 13:30 Dongsheng Yang
  2025-08-15 14:31 ` Mikulas Patocka
  0 siblings, 1 reply; 3+ messages in thread
From: Dongsheng Yang @ 2025-08-15 13:30 UTC (permalink / raw)
  To: mpatocka, agk, snitzer
  Cc: dm-devel, cengku, Dongsheng Yang, kernel test robot

The 'ret' varialbe may be returned without initialized in some branch,
this patch make sure it is initialized correctly with 0.

Fixes: 6fb8fbbaf147 ("dm-pcache: add persistent cache target in device-mapper")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508151712.qMqD87iI-lkp@intel.com/
Signed-off-by: Dongsheng Yang <dongsheng.yang@linux.dev>
---
 drivers/md/dm-pcache/cache_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-pcache/cache_dev.c b/drivers/md/dm-pcache/cache_dev.c
index 722d7e952262..a7dafe8d35f7 100644
--- a/drivers/md/dm-pcache/cache_dev.c
+++ b/drivers/md/dm-pcache/cache_dev.c
@@ -21,7 +21,7 @@ static int build_vmap(struct dax_device *dax_dev, long total_pages, void **vaddr
 	struct page **pages;
 	long i = 0, chunk;
 	unsigned long pfn;
-	int ret;
+	int ret = 0;
 
 	pages = vmalloc_array(total_pages, sizeof(struct page *));
 	if (!pages)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dm-pcache: fix uninitialized variable issue
  2025-08-15 13:30 [PATCH] dm-pcache: fix uninitialized variable issue Dongsheng Yang
@ 2025-08-15 14:31 ` Mikulas Patocka
  2025-08-15 14:40   ` Dongsheng Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2025-08-15 14:31 UTC (permalink / raw)
  To: Dongsheng Yang; +Cc: agk, snitzer, dm-devel, cengku, kernel test robot



On Fri, 15 Aug 2025, Dongsheng Yang wrote:

> The 'ret' varialbe may be returned without initialized in some branch,
> this patch make sure it is initialized correctly with 0.

Hi

I've already fixed it (and I folded the fix into the existing commit).

Mikulas

> Fixes: 6fb8fbbaf147 ("dm-pcache: add persistent cache target in device-mapper")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202508151712.qMqD87iI-lkp@intel.com/
> Signed-off-by: Dongsheng Yang <dongsheng.yang@linux.dev>
> ---
>  drivers/md/dm-pcache/cache_dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-pcache/cache_dev.c b/drivers/md/dm-pcache/cache_dev.c
> index 722d7e952262..a7dafe8d35f7 100644
> --- a/drivers/md/dm-pcache/cache_dev.c
> +++ b/drivers/md/dm-pcache/cache_dev.c
> @@ -21,7 +21,7 @@ static int build_vmap(struct dax_device *dax_dev, long total_pages, void **vaddr
>  	struct page **pages;
>  	long i = 0, chunk;
>  	unsigned long pfn;
> -	int ret;
> +	int ret = 0;
>  
>  	pages = vmalloc_array(total_pages, sizeof(struct page *));
>  	if (!pages)
> -- 
> 2.43.0
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dm-pcache: fix uninitialized variable issue
  2025-08-15 14:31 ` Mikulas Patocka
@ 2025-08-15 14:40   ` Dongsheng Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Dongsheng Yang @ 2025-08-15 14:40 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: agk, snitzer, dm-devel, cengku, kernel test robot


在 8/15/2025 10:31 PM, Mikulas Patocka 写道:
>
> On Fri, 15 Aug 2025, Dongsheng Yang wrote:
>
>> The 'ret' varialbe may be returned without initialized in some branch,
>> this patch make sure it is initialized correctly with 0.
> Hi
>
> I've already fixed it (and I folded the fix into the existing commit).


Okey, thanx


Dongsheng

>
> Mikulas
>
>> Fixes: 6fb8fbbaf147 ("dm-pcache: add persistent cache target in device-mapper")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202508151712.qMqD87iI-lkp@intel.com/
>> Signed-off-by: Dongsheng Yang <dongsheng.yang@linux.dev>
>> ---
>>   drivers/md/dm-pcache/cache_dev.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/md/dm-pcache/cache_dev.c b/drivers/md/dm-pcache/cache_dev.c
>> index 722d7e952262..a7dafe8d35f7 100644
>> --- a/drivers/md/dm-pcache/cache_dev.c
>> +++ b/drivers/md/dm-pcache/cache_dev.c
>> @@ -21,7 +21,7 @@ static int build_vmap(struct dax_device *dax_dev, long total_pages, void **vaddr
>>   	struct page **pages;
>>   	long i = 0, chunk;
>>   	unsigned long pfn;
>> -	int ret;
>> +	int ret = 0;
>>   
>>   	pages = vmalloc_array(total_pages, sizeof(struct page *));
>>   	if (!pages)
>> -- 
>> 2.43.0
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-15 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 13:30 [PATCH] dm-pcache: fix uninitialized variable issue Dongsheng Yang
2025-08-15 14:31 ` Mikulas Patocka
2025-08-15 14:40   ` Dongsheng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).