Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vt: ucs.c: fix misappropriate in_range() usage

The in_range() helper accepts a start and a length, not a start and
an end.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250507141535.40655-2-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Nicolas Pitre and committed by
Greg Kroah-Hartman
a16014c0 063a8964

+4 -4
+4 -4
drivers/tty/vt/ucs.c
··· 46 46 47 47 static bool cp_in_range16(u16 cp, const struct ucs_interval16 *ranges, size_t size) 48 48 { 49 - if (!in_range(cp, ranges[0].first, ranges[size - 1].last)) 49 + if (cp < ranges[0].first || cp > ranges[size - 1].last) 50 50 return false; 51 51 52 52 return __inline_bsearch(&cp, ranges, size, sizeof(*ranges), ··· 55 55 56 56 static bool cp_in_range32(u32 cp, const struct ucs_interval32 *ranges, size_t size) 57 57 { 58 - if (!in_range(cp, ranges[0].first, ranges[size - 1].last)) 58 + if (cp < ranges[0].first || cp > ranges[size - 1].last) 59 59 return false; 60 60 61 61 return __inline_bsearch(&cp, ranges, size, sizeof(*ranges), ··· 144 144 u32 ucs_recompose(u32 base, u32 mark) 145 145 { 146 146 /* Check if characters are within the range of our table */ 147 - if (!in_range(base, UCS_RECOMPOSE_MIN_BASE, UCS_RECOMPOSE_MAX_BASE) || 148 - !in_range(mark, UCS_RECOMPOSE_MIN_MARK, UCS_RECOMPOSE_MAX_MARK)) 147 + if (base < UCS_RECOMPOSE_MIN_BASE || base > UCS_RECOMPOSE_MAX_BASE || 148 + mark < UCS_RECOMPOSE_MIN_MARK || mark > UCS_RECOMPOSE_MAX_MARK) 149 149 return 0; 150 150 151 151 struct compare_key key = { base, mark };