Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build issues caused by -Wsign-compare and -Wincompatible-pointer-… #168

Closed

Conversation

lsandov1
Copy link

…types

In file included from ../../grub-core/net/http.c:19:
../../grub-core/net/http.c: In function ‘http_establish’:
../../grub-core/net/http.c:417:48: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘enum <anonymous>’ due to unsignedness of other operand [-Wsign-compare]
  417 |                 data->filename, server, port ? port : HTTP_PORT);
      |                                                ^~~~

../../grub-core/net/bootp.c: In function ‘grub_dhcp6_session_add’:
../../grub-core/net/bootp.c:1061:46: error: passing argument 2 of ‘grub_datetime2unixtime’ from incompatible pointer type [-Wincompatible-pointer-types]
 1061 |   if (err || !grub_datetime2unixtime (&date, &t))
      |                                              ^~
      |                                              |
      |                                              grub_int32_t * {aka int *}

In file included from ../../grub-core/net/bootp.c:27:
../../include/grub/datetime.h:55:77: note: expected ‘grub_int64_t *’ {aka ‘long int *’} but argument is of type ‘grub_int32_t *’ {aka ‘int *’}
   55 | grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int64_t *nix)
      |                                                               ~~~~~~~~~~~~~~^~~

../../grub-core/net/drivers/efi/efinet.c: In function ‘grub_efi_net_config_real’:
../../grub-core/net/drivers/efi/efinet.c:854:50: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types]
  854 |         struct grub_net_bootp_packet *dhcp_ack = &pxe_mode->dhcp_ack;
      |                                                  ^

../../grub-core/net/drivers/efi/efinet.c:859:57: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types]
  859 |             struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer;
      |                                                         ^

../../grub-core/net/drivers/efi/efinet.c: In function ‘grub_efi_net_config_real’:
../../grub-core/net/drivers/efi/efinet.c:859:57: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types]
  859 |             struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer;
      |                                                         ^

…types

    In file included from ../../grub-core/net/http.c:19:
    ../../grub-core/net/http.c: In function ‘http_establish’:
    ../../grub-core/net/http.c:417:48: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘enum <anonymous>’ due to unsignedness of other operand [-Wsign-compare]
      417 |                 data->filename, server, port ? port : HTTP_PORT);
          |                                                ^~~~

    ../../grub-core/net/bootp.c: In function ‘grub_dhcp6_session_add’:
    ../../grub-core/net/bootp.c:1061:46: error: passing argument 2 of ‘grub_datetime2unixtime’ from incompatible pointer type [-Wincompatible-pointer-types]
     1061 |   if (err || !grub_datetime2unixtime (&date, &t))
          |                                              ^~
          |                                              |
          |                                              grub_int32_t * {aka int *}

    In file included from ../../grub-core/net/bootp.c:27:
    ../../include/grub/datetime.h:55:77: note: expected ‘grub_int64_t *’ {aka ‘long int *’} but argument is of type ‘grub_int32_t *’ {aka ‘int *’}
       55 | grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int64_t *nix)
          |                                                               ~~~~~~~~~~~~~~^~~

    ../../grub-core/net/drivers/efi/efinet.c: In function ‘grub_efi_net_config_real’:
    ../../grub-core/net/drivers/efi/efinet.c:854:50: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types]
      854 |         struct grub_net_bootp_packet *dhcp_ack = &pxe_mode->dhcp_ack;
          |                                                  ^

    ../../grub-core/net/drivers/efi/efinet.c:859:57: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types]
      859 |             struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer;
          |                                                         ^

    ../../grub-core/net/drivers/efi/efinet.c: In function ‘grub_efi_net_config_real’:
    ../../grub-core/net/drivers/efi/efinet.c:859:57: error: initialization of ‘struct grub_net_bootp_packet *’ from incompatible pointer type ‘grub_efi_pxe_packet_t *’ [-Wincompatible-pointer-types]
      859 |             struct grub_net_bootp_packet *proxy_offer = &pxe_mode->proxy_offer;
          |                                                         ^

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
@lsandov1 lsandov1 closed this Jul 18, 2024
@lsandov1
Copy link
Author

These and other related changes found by the static analyzer will be collected at some point and create a larger MR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant