From: Jeremy Sowden <jeremy@azazel.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: Re: [ulogd2 PATCH v4 00/32] Fixes for compiler warnings
Date: Wed, 5 Jan 2022 22:48:30 +0000 [thread overview]
Message-ID: <YdYgPpxjhPP7IsiO@azazel.net> (raw)
In-Reply-To: <YdM8BYK5U+CMU+ow@salvia>
[-- Attachment #1.1: Type: text/plain, Size: 2889 bytes --]
On 2022-01-03, at 19:10:13 +0100, Pablo Neira Ayuso wrote:
> On Mon, Dec 06, 2021 at 11:21:01PM +0100, Pablo Neira Ayuso wrote:
> > On Tue, Nov 30, 2021 at 10:55:28AM +0000, Jeremy Sowden wrote:
> > > This patch-set fixes all the warnings reported by gcc 11.
> > >
> > > Most of the warnings concern fall-throughs in switches, possibly
> > > problematic uses of functions like `strncpy` and `strncat` and
> > > possible truncation of output by `sprintf` and its siblings.
> > >
> > > Some of the patches fix bugs revealed by warnings, some tweak code
> > > to avoid warnings, others fix or improve things I noticed while
> > > looking at the warnings.
> > >
> > > Changes since v3:
> > >
> > > * When publishing v3 I accidentally sent out two different
> > > versions of the patch-set under one cover-letter. There are
> > > no code-changes in v4: it just omits the earlier superseded
> > > patches.
> >
> > Applied from 1 to 19 (all inclusive)
>
> Applied remaining patches with comments.
>
> - Patch #20, #24 maybe consider conversion to snprintf at some point,
> not your fault, this code is using sprintf in many spots. I think
> the only problematic scenario which might trigger problems is the
> configuration path using too long object names.
Yeah, there definitely were other places where I started to make
changes, but held off to stop the patch-set becoming even bigger than it
already was and focus on fixing the warnings.
> - Patch #21, #22 and #25, maybe consolidate this database field from
> _ to . in a common function.
I've got the beginnings of a patch-set to do some tidying of the DB API.
There's an unused local variable left in the SQLITE3 plug-in. I've
attached a patch to remove it.
> - Patch #27, tm_gmtoff mod 86400 is really required? tm_gmtoff can be
> either -12/+12 * 60 * 60, simple assignment to integer should calm
> down the compiler?
The compiler wasn't smart enough to know that the range of tm_gmtoff is
±43200, so it couldn't work out that the hours would fit in `%+03d`
without the mod.
> - Patch #80, I guess you picked 80 just to provide a sufficiently
> large buffer to calm down compiler.
Correct.
> - Patch #31: I have replaced this patch with a check from .start and
> .signal paths to validate the unix socket path. The signal path of
> ulogd2 is problematic since configuration file errors should
> likely stop the daemon. I'll post it after this email.
Looks good.
> - Patch #32: this IPFIX plugin was tested with wireshark according to
> 4f639231c83b ("IPFIX: Add IPFIX output plugin"), I wonder if this
> attribute((packed)) is breaking anything, or maybe this was all
> tested on 32-bit?
I'll take a look.
> Anyway, after this update it's probably better to look at using
> pkg-config in the build system.
J.
[-- Attachment #1.2: 0001-output-SQLITE3-remove-unused-variable.patch --]
[-- Type: text/x-diff, Size: 943 bytes --]
From e45879a7ea5529c26f369c297295332143ee8420 Mon Sep 17 00:00:00 2001
From: Jeremy Sowden <jeremy@azazel.net>
Date: Wed, 5 Jan 2022 22:37:21 +0000
Subject: [PATCH] output: SQLITE3: remove unused variable
There's local variable left over from a previous tidy-up. Remove it.
Fixes: 67b0be90f16f ("output: SQLITE3: improve mapping of fields to DB columns")
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
output/sqlite3/ulogd_output_SQLITE3.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/output/sqlite3/ulogd_output_SQLITE3.c b/output/sqlite3/ulogd_output_SQLITE3.c
index 51eab782cc9d..0a9ad67edcff 100644
--- a/output/sqlite3/ulogd_output_SQLITE3.c
+++ b/output/sqlite3/ulogd_output_SQLITE3.c
@@ -320,7 +320,6 @@ sqlite3_init_db(struct ulogd_pluginstance *pi)
}
for (col = 0; col < num_cols; col++) {
- char *underscore;
struct field *f;
/* prepend it to the linked list */
--
2.34.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-01-05 22:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 10:55 [ulogd2 PATCH v4 00/32] Fixes for compiler warnings Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 01/32] jhash: add "fall through" comments to switch cases Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 02/32] db: add missing `break` to switch case Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 03/32] filter: HWHDR: simplify flow-control Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 04/32] filter: HWHDR: re-order KEY_RAW_MAC checks Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 05/32] filter: HWHDR: remove zero-initialization of MAC type Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 06/32] Replace malloc+memset with calloc Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 07/32] filter: PWSNIFF: replace malloc+strncpy with strndup Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 08/32] input: UNIXSOCK: remove stat of socket-path Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 09/32] input: UNIXSOCK: fix possible truncation of socket path Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 10/32] input: UNIXSOCK: prevent unaligned pointer access Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 11/32] output: DBI: fix deprecation warnings Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 12/32] output: DBI: improve mapping of DB columns to input-keys Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 13/32] output: DBI: fix NUL-termination of escaped SQL string Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 14/32] output: DBI: fix configuration of DB connection Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 15/32] output: MYSQL: improve mapping of DB columns to input-keys Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 16/32] output: PGSQL: " Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 17/32] output: PGSQL: fix non-`connstring` configuration of DB connection Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 18/32] output: SQLITE3: fix possible buffer overruns Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 19/32] output: SQLITE3: fix memory-leak in error-handling Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 20/32] output: SQLITE3: improve formatting of insert statement Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 21/32] output: SQLITE3: improve mapping of DB columns to fields Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 22/32] output: SQLITE3: improve mapping of fields to DB columns Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 23/32] output: SQLITE3: catch errors creating SQL statement Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 24/32] db: improve formatting of insert statement Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 25/32] db: improve mapping of input-keys to DB columns Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 26/32] db: simplify initialization of ring-buffer Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 27/32] output: JSON: fix output of GMT offset Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 28/32] output: JSON: increase time-stamp buffer size Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 29/32] output: JSON: fix possible leak in error-handling Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 30/32] output: JSON: optimize appending of newline to output Jeremy Sowden
2021-11-30 10:55 ` [ulogd2 PATCH v4 31/32] output: JSON: fix possible truncation of socket path Jeremy Sowden
2021-11-30 10:56 ` [ulogd2 PATCH v4 32/32] output: IPFIX: remove compiler attribute macros Jeremy Sowden
2021-12-06 22:20 ` [ulogd2 PATCH v4 00/32] Fixes for compiler warnings Pablo Neira Ayuso
2022-01-03 18:10 ` Pablo Neira Ayuso
2022-01-05 22:48 ` Jeremy Sowden [this message]
2022-01-10 0:22 ` Pablo Neira Ayuso
2022-01-06 21:00 ` Jeremy Sowden
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YdYgPpxjhPP7IsiO@azazel.net \
--to=jeremy@azazel.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox