Project

General

Profile

Actions

Bug #15489

open

cfgadm_plugins: the comparison will always evaluate as 'true'

Added by Toomas Soome 13 days ago. Updated 13 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

Build errors with gcc 12:

    ../common/shp.c: In function 'find_physical_slot_names':
    ../common/shp.c:1166:35: error: the comparison will always evaluate as 'true' for the address of 'slotnames' will never be NULL [-Werror=address]
     1166 |         if (slotarg->slotnames[0] != NULL)
          |                                   ^~
    ../common/shp.c:274:17: note: 'slotnames' declared here
      274 |         char    slotnames[MAXDEVS][MAXNAMELEN];
          |                 ^~~~~~~~~
    cc1: all warnings being treated as errors

    ../common/cfga.c: In function 'find_physical_slot_names':
    ../common/cfga.c:1296:35: error: the comparison will always evaluate as 'true' for the address of 'slotnames' will never be NULL [-Werror=address]
     1296 |         if (slotarg->slotnames[0] != NULL)
          |                                   ^~
    ../common/cfga.c:261:17: note: 'slotnames' declared here
      261 |         char    slotnames[MAXDEVS][MAXNAMELEN];
          |                 ^~~~~~~~~
    cc1: all warnings being treated as errors

Indeed, the arrays are allocated and therefore never NULL. Which always leads us to the question if the check is needed or if the condition statement is wrong.

Actions #1

Updated by Electric Monk 13 days ago

  • Gerrit CR set to 2720
Actions

Also available in: Atom PDF