All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] include/linux/mm: Initialize an int variable to prevent returning garbage value
@ 2022-05-24 17:27 ` Gautam Menghani
  0 siblings, 0 replies; 2+ messages in thread
From: Gautam Menghani @ 2022-05-24 17:27 UTC (permalink / raw)
  To: akpm; +Cc: Gautam Menghani, linux-mm, linux-kernel, linux-kernel-mentees, skhan

Initialize the variable 'ret' to prevent garbage value from being
returned. This Fixes the clang scan warning: Undefined or garbage value
returned to caller [core.uninitialized.UndefReturn]
        return ret;

Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
 include/linux/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9f44254af8ce..f437bd81d6a4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1700,7 +1700,7 @@ static inline int arch_make_page_accessible(struct page *page)
 #ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE
 static inline int arch_make_folio_accessible(struct folio *folio)
 {
-	int ret;
+	int ret = 0;
 	long i, nr = folio_nr_pages(folio);
 
 	for (i = 0; i < nr; i++) {
-- 
2.25.1


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

* [PATCH] include/linux/mm: Initialize an int variable to prevent returning garbage value
@ 2022-05-24 17:27 ` Gautam Menghani
  0 siblings, 0 replies; 2+ messages in thread
From: Gautam Menghani @ 2022-05-24 17:27 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel-mentees, linux-kernel, Gautam Menghani

Initialize the variable 'ret' to prevent garbage value from being
returned. This Fixes the clang scan warning: Undefined or garbage value
returned to caller [core.uninitialized.UndefReturn]
        return ret;

Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
 include/linux/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9f44254af8ce..f437bd81d6a4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1700,7 +1700,7 @@ static inline int arch_make_page_accessible(struct page *page)
 #ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE
 static inline int arch_make_folio_accessible(struct folio *folio)
 {
-	int ret;
+	int ret = 0;
 	long i, nr = folio_nr_pages(folio);
 
 	for (i = 0; i < nr; i++) {
-- 
2.25.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2022-05-24 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 17:27 [PATCH] include/linux/mm: Initialize an int variable to prevent returning garbage value Gautam Menghani
2022-05-24 17:27 ` Gautam Menghani

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.