connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <wagi@monom.org>
To: Matthias Gerstner <matthias.gerstner@suse.de>
Cc: connman@lists.linux.dev
Subject: Re: [PATCH 06/16] dnsproxy: refactoring of cache_update()
Date: Mon, 24 Oct 2022 09:03:04 +0200	[thread overview]
Message-ID: <20221024070304.df66xm4rlvju2435@beryllium.lan> (raw)
In-Reply-To: <20221018084746.21959-7-matthias.gerstner@suse.de>

On Tue, Oct 18, 2022 at 10:47:36AM +0200, Matthias Gerstner wrote:
> - move stack variables into more localized scopes
> - use const parameters and variables where possible
> - use named constants over literal numbers
> - simplify some parsing details by using byte order macros or adding
>   some comments to make the intentions cleare

This patch makes the compiler angry:

src/dnsproxy.c: In function ‘cache_update’:
src/dnsproxy.c:1399:44: warning: pointer targets in passing argument 1 of ‘parse_response’ differ in signedness [-Wpointer-sign]
 1399 |         const int err = parse_response(msg + offset, msg_len - offset,
      |                                        ~~~~^~~~~~~~
      |                                            |
      |                                            const char *
src/dnsproxy.c:986:48: note: expected ‘const unsigned char *’ but argument is of type ‘const char *’
  986 | static int parse_response(const unsigned char *buf, size_t buflen,
      |                           ~~~~~~~~~~~~~~~~~~~~~^~~
src/dnsproxy.c:1410:46: warning: pointer targets in passing argument 1 of ‘reply_query_type’ differ in signedness [-Wpointer-sign]
 1410 |                         reply_query_type(msg + offset,
      |                                          ~~~~^~~~~~~~
      |                                              |
      |                                              const char *
src/dnsproxy.c:1345:50: note: expected ‘const unsigned char *’ but argument is of type ‘const char *’
 1345 | static int reply_query_type(const unsigned char *msg, int len)
      |                             ~~~~~~~~~~~~~~~~~~~~~^~~
src/dnsproxy.c: In function ‘forward_dns_reply’:
src/dnsproxy.c:2149:36: warning: pointer targets in passing argument 2 of ‘cache_update’ differ in signedness [-Wpointer-sign]
 2149 |                 cache_update(data, reply, reply_len);
      |                                    ^~~~~
      |                                    |
      |                                    unsigned char *
src/dnsproxy.c: In function ‘cache_update’:
src/dnsproxy.c:1365:62: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
 1365 | static int cache_update(struct server_data *srv, const char *msg, size_t msg_len)
      |                                                  ~~~~~~~~~~~~^~~
src/dnsproxy.c:1399:44: warning: pointer targets in passing argument 1 of ‘parse_response’ differ in signedness [-Wpointer-sign]
 1399 |         const int err = parse_response(msg + offset, msg_len - offset,
      |                                        ~~~~^~~~~~~~
      |                                            |
      |                                            const char *
src/dnsproxy.c:986:48: note: expected ‘const unsigned char *’ but argument is of type ‘const char *’
  986 | static int parse_response(const unsigned char *buf, size_t buflen,
      |                           ~~~~~~~~~~~~~~~~~~~~~^~~
src/dnsproxy.c:1410:46: warning: pointer targets in passing argument 1 of ‘reply_query_type’ differ in signedness [-Wpointer-sign]
 1410 |                         reply_query_type(msg + offset,
      |                                          ~~~~^~~~~~~~
      |                                              |
      |                                              const char *
src/dnsproxy.c:1345:50: note: expected ‘const unsigned char *’ but argument is of type ‘const char *’
 1345 | static int reply_query_type(const unsigned char *msg, int len)
      |                             ~~~~~~~~~~~~~~~~~~~~~^~~
src/dnsproxy.c: In function ‘forward_dns_reply’:
src/dnsproxy.c:2149:36: warning: pointer targets in passing argument 2 of ‘cache_update’ differ in signedness [-Wpointer-sign]
 2149 |                 cache_update(data, reply, reply_len);
      |                                    ^~~~~
      |                                    |
      |                                    unsigned char *
src/dnsproxy.c:1365:62: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
 1365 | static int cache_update(struct server_data *srv, const char *msg, size_t msg_len)
      |                                                  ~~~~~~~~~~~~^~~

  reply	other threads:[~2022-10-24  7:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  8:47 dnsproxy: first round of refactoring, TCP bugfix Matthias Gerstner
2022-10-18  8:47 ` [PATCH 01/16] dnsproxy-simple-test: improve test coverage and test flexibility Matthias Gerstner
2022-10-18  8:47 ` [PATCH 02/16] autoconf: require C99 compiler and set C99 mode Matthias Gerstner
2022-10-18  8:47 ` [PATCH 03/16] dnsproxy: first bits of refactoring data types, global variables, simpler functions Matthias Gerstner
2022-10-24  6:59   ` Daniel Wagner
2022-10-18  8:47 ` [PATCH 04/16] dnsproxy: refactoring of update_cached_ttl() and append_data() Matthias Gerstner
2022-10-18  8:47 ` [PATCH 05/16] dnsproxy: refactor parse_response() Matthias Gerstner
2022-10-18  8:47 ` [PATCH 06/16] dnsproxy: refactoring of cache_update() Matthias Gerstner
2022-10-24  7:03   ` Daniel Wagner [this message]
2022-10-18  8:47 ` [PATCH 07/16] dnsproxy: strip_domains(): fix out of bounds read access Matthias Gerstner
2022-10-18  8:47 ` [PATCH 08/16] dnsproxy: refactor and document strip_domains() to make it less confusing Matthias Gerstner
2022-10-18  8:47 ` [PATCH 09/16] dnsproxy: refactor ns_resolv() and forwards_dns_reply() Matthias Gerstner
2022-10-18  8:47 ` [PATCH 10/16] dnsproxy: uncompress: replace unnecessary goto with return statements Matthias Gerstner
2022-10-18  8:47 ` [PATCH 11/16] dnsproxy: forward_dns_reply: pull out separate dns_reply_fixup_domains() Matthias Gerstner
2022-10-18  8:47 ` [PATCH 12/16] dnsproxy: finish first pass of refactoring the compilation unit Matthias Gerstner
2022-10-18  8:47 ` [PATCH 13/16] dnsproxy: fix TCP server reply handling if domain name is appended Matthias Gerstner
2022-10-18  8:47 ` [PATCH 14/16] dnsproxy: harmonize use of sizeof() for message size calculations Matthias Gerstner
2022-10-18  8:47 ` [PATCH 15/16] dnsproxy: add my copyright statement covering the larger refactoring changes Matthias Gerstner
2022-10-18  8:47 ` [PATCH 16/16] dnsproxy: fix compiler warnings (differing signedness, empty format string) Matthias Gerstner
2022-10-18  8:55 ` dnsproxy: first round of refactoring, TCP bugfix Matthias Gerstner
2022-10-24  7:40   ` Daniel Wagner
  -- strict thread matches above, loose matches on Subject: below --
2022-06-10 12:33 Matthias Gerstner
2022-06-10 12:33 ` [PATCH 06/16] dnsproxy: refactoring of cache_update() Matthias Gerstner

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=20221024070304.df66xm4rlvju2435@beryllium.lan \
    --to=wagi@monom.org \
    --cc=connman@lists.linux.dev \
    --cc=matthias.gerstner@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).