Skip to content

Commit

Permalink
[IA64] unsigned cannot be less than 0 in sn_hwperf_ioctl()
Browse files Browse the repository at this point in the history
struct sn_hwperf_ioctl_args member arg (u64) cannot be less than 0.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Tony Luck <[email protected]>
  • Loading branch information
RoelKluin authored and aegl committed Oct 13, 2009
1 parent 29e4e02 commit dec1798
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions arch/ia64/sn/kernel/sn2/sn_hwperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dec1798

Please sign in to comment.