On Thu, Jan 16, 2020 at 10:52:06AM +0100, Martin Pieuchot wrote:
> Found while compiling sgi kernel:
> 
> /sys/netinet/igmp.c:140:22: error: implicit conversion from 'int' to 'int8_t'
>       (aka 'signed char') changes value from 148 to -108
>       [-Werror,-Wconstant-conversion]
>         ra->ipopt_list[0] = IPOPT_RA;
>                           ~ ^~~~~~~~
> /sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA'
> 
> Use an unsigned type in this case:

People argued against some of these types of changes previously.
That is why kernels built with clang use -Wno-constant-conversion.

patrick proposed this change in 2017 but it didn't happen
https://marc.info/?l=openbsd-tech&m=148490401504785&w=2

> 
> Index: netinet/ip_var.h
> ===================================================================
> RCS file: /cvs/src/sys/netinet/ip_var.h,v
> retrieving revision 1.86
> diff -u -p -r1.86 ip_var.h
> --- netinet/ip_var.h  8 Dec 2019 11:08:22 -0000       1.86
> +++ netinet/ip_var.h  16 Jan 2020 09:48:41 -0000
> @@ -92,7 +92,7 @@ struct      ipstat {
>  
>  struct ipoption {
>       struct  in_addr ipopt_dst;      /* first-hop dst if source routed */
> -     int8_t  ipopt_list[MAX_IPOPTLEN];       /* options proper */
> +     uint8_t ipopt_list[MAX_IPOPTLEN];       /* options proper */
>  };
>  
>  #ifdef _KERNEL
> 
> 

Reply via email to