Page MenuHomeFreeBSD

usr.sbin/wpa/wpa_supplicant: build warning fixes
Needs ReviewPublic

Authored by aprieger_llnw.com on Jun 2 2017, 9:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 10:59 PM
Unknown Object (File)
Aug 19 2023, 3:28 PM
Unknown Object (File)
May 29 2023, 3:27 PM
Unknown Object (File)
May 4 2023, 4:23 PM
Unknown Object (File)
Jan 14 2023, 1:32 PM
Subscribers

Details

Reviewers
kbowling
sbruno
Summary

usr.sbin/wpa/wpa_supplicant (WPA/802.11i Supplicant for wireless network devices) build time warning fixes

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Changelog:
Pre-fix warnings are at: https://gist.github.com/aprieger-llnw/3a1e9084e4dde2b7e6675ce071c92d21

  1. contrib/wpa/src/drivers/driver_ndis.c
    • Warnings:
      • warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
      • warning: passing 'PTSTR' (aka 'char *') to parameter of type 'int8_t *' (aka 'signed char *') converts between pointers to integer types with different sign [-Wpointer-sign]
      • warning: passing 'char [128]' to parameter of type 'int8_t *' (aka 'signed char *') converts between pointers to integer types with different sign [-Wpointer-sign]
    • Fixes:
      • changed the string format type from "%d" to "%lu" to handle the "unsigned long" variable instead of "int" on lines 507, 513, 576, 1539, 1573, 1595, 1786
      • changed the string format type from "%d" to "%u" to handle the "unsigned int" variable instead of "int" on lines 513
      • added the explicit modifier "int8_t*" to variables on lines 2142, 2148, 2764, 3067, 3073
  2. contrib/wpa/src/drivers/Packet32.c
    • Warnings:
      • warning: passing 'int8_t *' (aka 'signed char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
      • warning: assigning to 'char *' from 'int8_t *' (aka 'signed char *') converts between pointers to integer types with different sign [-Wpointer-sign]
    • Fixes:
      • added the explicit modifier "const char*" to variables on lines 128, 130, 136, 147
      • added the explicit modifer "char *" to variable on line 247

For code in contrib/ we should really work with upstream on fixes - wpa_supplicant's upstream is https://w1.fi/wpa_supplicant/. It may be that they have a large set of compilers they need to support, and those might not support e.g. %z.

contrib/wpa/src/drivers/driver_ndis.c
507

The z modifier should be used for size_t (so %zu here)

Edit: changed the format modification for "size_t" types from"%lu" to "%zu"

aprieger_llnw.com marked an inline comment as done.