Re: [PATCH v7 18/21] auxdisplay: ht16k33: Add support for segment displays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On Fri, Oct 15, 2021 at 10:48 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> url:    https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/auxdisplay-ht16k33-Add-character-display-support/20211013-025705
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
> config: i386-randconfig-m031-20211012 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> smatch warnings:
> include/uapi/linux/map_to_14segment.h:87 map_to_seg14() error: buffer overflow 'map->table' 128 <= 255
> include/uapi/linux/map_to_14segment.h:87 map_to_seg14() error: buffer overflow 'map->table' 128 <= 255
> include/uapi/linux/map_to_14segment.h:87 map_to_seg14() error: buffer overflow 'map->table' 128 <= 255
>
> vim +87 include/uapi/linux/map_to_14segment.h
>
> d26423994040a7 Geert Uytterhoeven 2021-10-12  85  static __inline__ int map_to_seg14(struct seg14_conversion_map *map, int c)
> d26423994040a7 Geert Uytterhoeven 2021-10-12  86  {
> d26423994040a7 Geert Uytterhoeven 2021-10-12 @87        return c >= 0 && c < sizeof(map->table) ? __be16_to_cpu(map->table[c])
>                                                                          ^^^^^^^^^^^^^^^^^^^^^^

Nice catch, thanks a lot!

> This needs to be c < ARRAY_SIZE(map->table) instead of sizeof().

I don't think we can use ARRAY_SIZE() in uapi (although there are
two users, which thus rely on an external definition), so I'll
open-code it.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux