summary refs log tree commit diff
path: root/arch/ia64
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-10-10 22:21:59 +0200
committerTony Luck <tony.luck@intel.com>2009-10-13 10:40:00 -0700
commitdec1798f81f7e8a299734bdc29197ae77bf08018 (patch)
tree308a3a3b50b79871c8d7c73ed25845ad6abcc640 /arch/ia64
parent29e4e025be52c0619b9dfe6faba29bc3deac6272 (diff)
downloadlinux-dec1798f81f7e8a299734bdc29197ae77bf08018.tar.gz
[IA64] unsigned cannot be less than 0 in sn_hwperf_ioctl()
struct sn_hwperf_ioctl_args member arg (u64) cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 4c7e74790958..55ac3c4e11d2 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;