diff options
Diffstat (limited to 'drivers/usb/input/map_to_7segment.h')
-rw-r--r-- | drivers/usb/input/map_to_7segment.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/input/map_to_7segment.h b/drivers/usb/input/map_to_7segment.h index 52ff27f1512..a424094d9fe 100644 --- a/drivers/usb/input/map_to_7segment.h +++ b/drivers/usb/input/map_to_7segment.h | |||
@@ -79,7 +79,7 @@ struct seg7_conversion_map { | |||
79 | 79 | ||
80 | static inline int map_to_seg7(struct seg7_conversion_map *map, int c) | 80 | static inline int map_to_seg7(struct seg7_conversion_map *map, int c) |
81 | { | 81 | { |
82 | return c & 0x7f ? map->table[c] : -EINVAL; | 82 | return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; |
83 | } | 83 | } |
84 | 84 | ||
85 | #define SEG7_CONVERSION_MAP(_name, _map) \ | 85 | #define SEG7_CONVERSION_MAP(_name, _map) \ |