diff options
| -rw-r--r-- | arch/ia64/sn/kernel/sn2/sn_hwperf.c | 7 |
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) | |||
| 786 | break; | 786 | break; |
| 787 | 787 | ||
| 788 | case SN_HWPERF_GET_OBJ_NODE: | 788 | case SN_HWPERF_GET_OBJ_NODE: |
| 789 | if (a.sz != sizeof(u64) || a.arg < 0) { | 789 | i = a.arg; |
| 790 | if (a.sz != sizeof(u64) || i < 0) { | ||
| 790 | r = -EINVAL; | 791 | r = -EINVAL; |
| 791 | goto error; | 792 | goto error; |
| 792 | } | 793 | } |
| 793 | if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { | 794 | if ((r = sn_hwperf_enum_objects(&nobj, &objs)) == 0) { |
| 794 | if (a.arg >= nobj) { | 795 | if (i >= nobj) { |
| 795 | r = -EINVAL; | 796 | r = -EINVAL; |
| 796 | vfree(objs); | 797 | vfree(objs); |
| 797 | goto error; | 798 | goto error; |
| 798 | } | 799 | } |
| 799 | if (objs[(i = a.arg)].id != a.arg) { | 800 | if (objs[i].id != a.arg) { |
| 800 | for (i = 0; i < nobj; i++) { | 801 | for (i = 0; i < nobj; i++) { |
| 801 | if (objs[i].id == a.arg) | 802 | if (objs[i].id == a.arg) |
| 802 | break; | 803 | break; |
