diff --git a/src/hidpp10.c b/src/hidpp10.c index 0dbad2b9..ce4ccd3c 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -1023,7 +1023,7 @@ hidpp10_read_memory(struct hidpp10_device *dev, uint8_t page, uint16_t offset, return -EINVAL; } - if (page > 31) + if (page > HIDPP10_MAX_PAGE_NUMBER) return -EINVAL; hidpp_log_raw(&dev->base, "Reading memory page %d, offset %#x\n", page, offset); diff --git a/src/hidpp10.h b/src/hidpp10.h index ec27724c..f6980f37 100644 --- a/src/hidpp10.h +++ b/src/hidpp10.h @@ -38,6 +38,8 @@ * 0 is zeroed, 1 and 2 are garbage, all above 6 is garbage */ #define HIDPP10_NUM_PROFILES 3 +#define HIDPP10_MAX_PAGE_NUMBER 31 + struct hidpp10_device { struct hidpp_device base; unsigned index;