Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dec1798f authored by Roel Kluin's avatar Roel Kluin Committed by Tony Luck
Browse files

[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: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 29e4e025
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -786,17 +786,18 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
		break;
		break;


	case SN_HWPERF_GET_OBJ_NODE:
	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;
			r = -EINVAL;
			goto error;
			goto error;
		}
		}
		if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
		if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) {
			if (a.arg >= nobj) {
			if (i >= nobj) {
				r = -EINVAL;
				r = -EINVAL;
				vfree(objs);
				vfree(objs);
				goto error;
				goto error;
			}
			}
			if (objs[(i = a.arg)].id != a.arg) {
			if (objs[i].id != a.arg) {
				for (i = 0; i < nobj; i++) {
				for (i = 0; i < nobj; i++) {
					if (objs[i].id == a.arg)
					if (objs[i].id == a.arg)
						break;
						break;