linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/proc/task_mmu: fix uninitialized variable in pagemap_pmd_range()
@ 2024-06-13 14:34 Dan Carpenter
  2024-06-13 14:47 ` David Hildenbrand
  2024-06-14  7:09 ` Muhammad Usama Anjum
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-06-13 14:34 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Andrew Morton, Matthew Wilcox, Muhammad Usama Anjum, Andrei Vagin,
	Ryan Roberts, Hugh Dickins, Kefeng Wang, linux-kernel,
	linux-fsdevel, kernel-janitors

The "folio" pointer is tested for NULL, but it's either valid or
uninitialized.  Initialize it to NULL.

Fixes: 84f57f8b8914 ("fs/proc: move page_mapcount() to fs/proc/internal.h")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/proc/task_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 631371cb80a0..6ed1f56b32b4 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1492,7 +1492,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
 		u64 flags = 0, frame = 0;
 		pmd_t pmd = *pmdp;
 		struct page *page = NULL;
-		struct folio *folio;
+		struct folio *folio = NULL;
 
 		if (vma->vm_flags & VM_SOFTDIRTY)
 			flags |= PM_SOFT_DIRTY;
-- 
2.43.0


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

* Re: [PATCH] fs/proc/task_mmu: fix uninitialized variable in pagemap_pmd_range()
  2024-06-13 14:34 [PATCH] fs/proc/task_mmu: fix uninitialized variable in pagemap_pmd_range() Dan Carpenter
@ 2024-06-13 14:47 ` David Hildenbrand
  2024-06-14  7:09 ` Muhammad Usama Anjum
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2024-06-13 14:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Matthew Wilcox, Muhammad Usama Anjum, Andrei Vagin,
	Ryan Roberts, Hugh Dickins, Kefeng Wang, linux-kernel,
	linux-fsdevel, kernel-janitors

On 13.06.24 16:34, Dan Carpenter wrote:
> The "folio" pointer is tested for NULL, but it's either valid or
> uninitialized.  Initialize it to NULL.
> 
> Fixes: 84f57f8b8914 ("fs/proc: move page_mapcount() to fs/proc/internal.h")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   fs/proc/task_mmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 631371cb80a0..6ed1f56b32b4 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1492,7 +1492,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
>   		u64 flags = 0, frame = 0;
>   		pmd_t pmd = *pmdp;
>   		struct page *page = NULL;
> -		struct folio *folio;
> +		struct folio *folio = NULL;
>   
>   		if (vma->vm_flags & VM_SOFTDIRTY)
>   			flags |= PM_SOFT_DIRTY;

Acked-by: David Hildenbrand <david@redhat.com>

Thanks!

-- 
Cheers,

David / dhildenb


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

* Re: [PATCH] fs/proc/task_mmu: fix uninitialized variable in pagemap_pmd_range()
  2024-06-13 14:34 [PATCH] fs/proc/task_mmu: fix uninitialized variable in pagemap_pmd_range() Dan Carpenter
  2024-06-13 14:47 ` David Hildenbrand
@ 2024-06-14  7:09 ` Muhammad Usama Anjum
  1 sibling, 0 replies; 3+ messages in thread
From: Muhammad Usama Anjum @ 2024-06-14  7:09 UTC (permalink / raw)
  To: Dan Carpenter, David Hildenbrand
  Cc: Muhammad Usama Anjum, Andrew Morton, Matthew Wilcox, Andrei Vagin,
	Ryan Roberts, Hugh Dickins, Kefeng Wang, linux-kernel,
	linux-fsdevel, kernel-janitors

On 6/13/24 7:34 PM, Dan Carpenter wrote:
> The "folio" pointer is tested for NULL, but it's either valid or
> uninitialized.  Initialize it to NULL.
> 
> Fixes: 84f57f8b8914 ("fs/proc: move page_mapcount() to fs/proc/internal.h")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  fs/proc/task_mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 631371cb80a0..6ed1f56b32b4 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1492,7 +1492,7 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
>  		u64 flags = 0, frame = 0;
>  		pmd_t pmd = *pmdp;
>  		struct page *page = NULL;
> -		struct folio *folio;
> +		struct folio *folio = NULL;
>  
>  		if (vma->vm_flags & VM_SOFTDIRTY)
>  			flags |= PM_SOFT_DIRTY;
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

-- 
BR,
Muhammad Usama Anjum

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

end of thread, other threads:[~2024-06-14  7:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 14:34 [PATCH] fs/proc/task_mmu: fix uninitialized variable in pagemap_pmd_range() Dan Carpenter
2024-06-13 14:47 ` David Hildenbrand
2024-06-14  7:09 ` Muhammad Usama Anjum

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).