Project

General

Profile

Actions

Bug #5538

closed

Compiler Warning on Fedora 36 / gcc 12.2.1

Added by Jason Taylor over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

On my Fedora 36 system with gcc 12.2.1 compiling the latest git master :

CC       main.o
CC alert-debuglog.o
CC alert-fastlog.o
CC alert-syslog.o
CC app-layer.o
CC app-layer-detect-proto.o
In file included from suricata-common.h:501,
from app-layer-detect-proto.c:25:
util-debug.h: In function ‘AppLayerProtoDetectGetProto’:
util-debug.h:330:31: warning: ‘alproto_masks’ may be used uninitialized [-Wmaybe-uninitialized]
330 | #define SCLogDebug(...) SCLog(SC_LOG_DEBUG, FILE, FUNCTION, LINE, VA_ARGS) | ^~~
app-layer-detect-proto.c:520:15: note: ‘alproto_masks’ was declared here
520 | uint32_t *alproto_masks; | ^~~~~~~~~~~
CC app-layer-dnp3.o
CC app-layer-dnp3-objects.o
CC app-layer-enip.o

Otherwise compiles without warnings/errors
$ suricata -V
This is Suricata version 7.0.0-dev (fe9150632 2022-09-08)

Actions #1

Updated by Victor Julien over 2 years ago

  • Status changed from New to Assigned
  • Assignee changed from OISF Dev to Philippe Antoine
  • Priority changed from Low to Normal
  • Target version changed from TBD to 7.0.0-beta1
Actions #2

Updated by Philippe Antoine over 2 years ago

I have seen it with a recent clang as well.

The real fix would be to have a better logic in AppLayerProtoDetectGetProto not using goto
I said fix because the real bug is in the static analyzer which gets messed up by these gotos

I will take a deeper look

Actions #3

Updated by Philippe Antoine about 2 years ago

  • Status changed from Assigned to Closed

I took a deeper look :
- The commit already in master fixed the warning
- I did not see how the previous code could lead to use of uninitialized value
- The code is terribly messy and I understand that a static analyzer can produce a "false positive" on this (or you can say a true positive if it puts a red flag on ugly code)

So closing as is

Actions

Also available in: Atom PDF