public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SN: unsigned cannot be less than 0 in sn_hwperf_ioctl()
@ 2009-10-10 20:21 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-10-10 20:21 UTC (permalink / raw)
  To: linux-ia64

struct sn_hwperf_ioctl_args member arg (u64) cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
// vi arch/ia64/include/asm/sn/sn2/sn_hwperf.h +73
struct sn_hwperf_ioctl_args {
        u64 arg;		/* argument, usually an object id */
        u64 sz;                 /* size of transfer */
        void *ptr;              /* pointer to source/target */
        u32 v0;			/* second return value */
};

diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 4c7e747..55ac3c4 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -786,17 +786,18 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
 		break;
 
 	case SN_HWPERF_GET_OBJ_NODE:
-		if (a.sz != sizeof(u64) || a.arg < 0) {
+		i = a.arg;
+		if (a.sz != sizeof(u64) || i < 0) {
 			r = -EINVAL;
 			goto error;
 		}
 		if ((r = sn_hwperf_enum_objects(&nobj, &objs)) = 0) {
-			if (a.arg >= nobj) {
+			if (i >= nobj) {
 				r = -EINVAL;
 				vfree(objs);
 				goto error;
 			}
-			if (objs[(i = a.arg)].id != a.arg) {
+			if (objs[i].id != a.arg) {
 				for (i = 0; i < nobj; i++) {
 					if (objs[i].id = a.arg)
 						break;

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

only message in thread, other threads:[~2009-10-10 20:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-10 20:21 [PATCH] SN: unsigned cannot be less than 0 in sn_hwperf_ioctl() Roel Kluin

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