mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] FS-Cache: Add missing initialization of ret in cachefiles_write_page()
@ 2015-11-11 23:02 Geert Uytterhoeven
  2015-11-12 10:15 ` David Howells
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-11-11 23:02 UTC (permalink / raw)
  To: David Howells, Al Viro; +Cc: linux-cachefs, linux-kernel, Geert Uytterhoeven

fs/cachefiles/rdwr.c: In function ‘cachefiles_write_page’:
fs/cachefiles/rdwr.c:882: warning: ‘ret’ may be used uninitialized in
this function

If the jump to label "error" is taken, "ret" will indeed be
uninitialized, and random stack data may be printed by the debug code.

Fixes: 102f4d900c9c8f5e ("FS-Cache: Handle a write to the page immediately beyond the EOF marker")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 fs/cachefiles/rdwr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 7a6b02f727874352..bdd28fe9a7f7195b 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -879,7 +879,7 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
 	loff_t pos, eof;
 	size_t len;
 	void *data;
-	int ret;
+	int ret = 0;
 
 	ASSERT(op != NULL);
 	ASSERT(page != NULL);
-- 
1.9.1


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

end of thread, other threads:[~2015-11-12 10:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 23:02 [PATCH] FS-Cache: Add missing initialization of ret in cachefiles_write_page() Geert Uytterhoeven
2015-11-12 10:15 ` David Howells
2015-11-12 10:23   ` Geert Uytterhoeven
2015-11-12 10:42   ` David Howells
2015-11-12 10:43     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®