All of lore.kernel.org
 help / color / mirror / Atom feed
* + pagemaph-fix-warning-about-possibly-used-before-init-var.patch added to -mm tree
@ 2012-04-16 21:50 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2012-04-16 21:50 UTC (permalink / raw)
  To: mm-commits; +Cc: paul.gortmaker, daniel.vetter


The patch titled
     Subject: pagemap.h: fix warning about possibly used before init var
has been added to the -mm tree.  Its filename is
     pagemaph-fix-warning-about-possibly-used-before-init-var.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: pagemap.h: fix warning about possibly used before init var

Commit f56f821feb7b36223f309e0ec05986bb137ce418 (linux-next)

    "mm: extend prefault helpers to fault in more than PAGE_SIZE"

added in the new functions:

	fault_in_multipages_writeable
	fault_in_multipages_readable

However, we currently see:

  include/linux/pagemap.h:492: warning: 'ret' may be used uninitialized in this function
  include/linux/pagemap.h:492: note: 'ret' was declared here

Unlike a lot of gcc nags, this one appears somewhat legit.  i.e.  passing
in an invalid negative value of "size" does make it look like all the
conditionals in there would be bypassed and the uninitialized value would
be returned.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/pagemap.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff -puN include/linux/pagemap.h~pagemaph-fix-warning-about-possibly-used-before-init-var include/linux/pagemap.h
--- a/include/linux/pagemap.h~pagemaph-fix-warning-about-possibly-used-before-init-var
+++ a/include/linux/pagemap.h
@@ -460,11 +460,11 @@ static inline int fault_in_pages_readabl
  */
 static inline int fault_in_multipages_writeable(char __user *uaddr, int size)
 {
-	int ret;
+	int ret = 0;
 	char __user *end = uaddr + size - 1;
 
 	if (unlikely(size == 0))
-		return 0;
+		return ret;
 
 	/*
 	 * Writing zeroes into userspace here is OK, because we know that if
@@ -489,11 +489,11 @@ static inline int fault_in_multipages_re
 					       int size)
 {
 	volatile char c;
-	int ret;
+	int ret = 0;
 	const char __user *end = uaddr + size - 1;
 
 	if (unlikely(size == 0))
-		return 0;
+		return ret;
 
 	while (uaddr <= end) {
 		ret = __get_user(c, uaddr);
_
Subject: Subject: pagemap.h: fix warning about possibly used before init var

Patches currently in -mm which might be from paul.gortmaker@windriver.com are

linux-next.patch
pagemaph-fix-warning-about-possibly-used-before-init-var.patch
rapidio-add-dma-engine-support-for-rio-data-transfers.patch
rapidio-tsi721-add-dma-engine-support.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-16 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-16 21:50 + pagemaph-fix-warning-about-possibly-used-before-init-var.patch added to -mm tree akpm

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.