+ hvsi-messed-up-error-checking-getting-state-name.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     hvsi: fix messed up error checking getting state name
has been added to the -mm tree.  Its filename is
     hvsi-messed-up-error-checking-getting-state-name.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 ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: hvsi: fix messed up error checking getting state name
From: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>

Handle out-of-range indices before reading what they refer to.  And don't
access the one-past-the-end element of the array either.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@xxxxxxxxx>
Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Cc: Roel Kluin <roel.kluin@xxxxxxxxx>
Cc: Grant Likely <grant.likely@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/char/hvsi.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff -puN drivers/char/hvsi.c~hvsi-messed-up-error-checking-getting-state-name drivers/char/hvsi.c
--- a/drivers/char/hvsi.c~hvsi-messed-up-error-checking-getting-state-name
+++ a/drivers/char/hvsi.c
@@ -194,10 +194,8 @@ static inline void print_state(struct hv
 		"HVSI_WAIT_FOR_MCTRL_RESPONSE",
 		"HVSI_FSP_DIED",
 	};
-	const char *name = state_names[hp->state];
-
-	if (hp->state > ARRAY_SIZE(state_names))
-		name = "UNKNOWN";
+	const char *name = (hp->state < ARRAY_SIZE(state_names))
+		? state_names[hp->state] : "UNKNOWN";
 
 	pr_debug("hvsi%i: state = %s\n", hp->index, name);
 #endif /* DEBUG */
_

Patches currently in -mm which might be from ext-phil.2.carmody@xxxxxxxxx are

errh-add-__must_check-to-error-pointer-handlers.patch
hvsi-messed-up-error-checking-getting-state-name.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux