netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Xie He <xie.he.0141@gmail.com>
Cc: Chas Williams <3chas3@gmail.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-atm-general@lists.sourceforge.net,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning
Date: Tue, 27 Oct 2020 14:23:46 +0100	[thread overview]
Message-ID: <CAK8P3a3JTg5Mi2XC9AEC+YwH552M_TXDY4BaULZz5WmEb3woRQ@mail.gmail.com> (raw)
In-Reply-To: <CAJht_EPSs6W-r6kpWUNQDPzCjL-+_8mqq2JBoY=qhsQREgn92g@mail.gmail.com>

On Tue, Oct 27, 2020 at 5:02 AM Xie He <xie.he.0141@gmail.com> wrote:
>
> On Mon, Oct 26, 2020 at 8:56 PM Xie He <xie.he.0141@gmail.com> wrote:
> >
> > > -  for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)
> > > +  for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem)
> >
> > Note that these two lines are semantically different. In the first line,
> > "+ 1" moves the pointer by (sizeof memmap) bytes. However in the second
> > line, "+ 1" moves the pointer by only 1 byte.
>
> Correction: in the first line "+ 1" moves the pointer by (sizeof *memmap) bytes.

Ah, of course. I had looked up the types but mixed up the memmap
and HDW definitions, but then got confused trying to understand the
logic in wr_mem() that operates on bytes but expands them into
multiples of 4.

I've modified it as below now, will resend along with the other patches
if you think this makes sense.

        Arnd

--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -1815,7 +1815,7 @@ static int hrz_init(hrz_dev *dev)

   int buff_count;

-  HDW * mem;
+  uintptr_t offset;

   cell_buf * tx_desc;
   cell_buf * rx_desc;
@@ -1841,8 +1841,8 @@ static int hrz_init(hrz_dev *dev)

   printk (" clearing memory");

-  for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem)
-    wr_mem (dev, mem, 0);
+  for (offset = 0; offset < sizeof(struct MEMMAP); offset++)
+    wr_mem (dev, (HDW *)offset, 0);

   printk (" tx channels");

  reply	other threads:[~2020-10-27 13:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 21:29 [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning Arnd Bergmann
2020-10-26 21:29 ` [PATCH net-next 02/11] net: hostap: fix function cast warning Arnd Bergmann
2020-11-07 11:37   ` Kalle Valo
2020-10-26 21:29 ` [PATCH net-next 04/11] wimax: fix duplicate initializer warning Arnd Bergmann
2020-10-27  7:22   ` Johannes Berg
2020-10-27 11:51     ` Arnd Bergmann
2020-10-27 14:51       ` Perez-Gonzalez, Inaky
2020-10-26 21:29 ` [PATCH net-next 05/11] wimax/i2400m/control: fix enum warning Arnd Bergmann
2020-10-26 21:29 ` [PATCH net-next 06/11] rtlwifi: fix -Wpointer-sign warning Arnd Bergmann
2020-10-27  1:29   ` Pkshih
2020-10-26 21:29 ` [PATCH net-next 07/11] rtw88: remove extraneous 'const' qualifier Arnd Bergmann
2020-10-27  1:49   ` Nathan Chancellor
2020-10-26 21:29 ` [PATCH net-next 08/11] ath9k: work around false-positive gcc warning Arnd Bergmann
2020-11-02 16:26   ` Kalle Valo
2020-11-02 17:59     ` Johannes Berg
2020-11-02 22:29       ` Arnd Bergmann
2020-11-07 11:18       ` Kalle Valo
2020-11-07 11:36         ` Arnd Bergmann
2020-11-10 18:13   ` Kalle Valo
2020-10-26 21:29 ` [PATCH net-next 09/11] ath6kl: fix enum-conversion warning Arnd Bergmann
2020-10-27  6:15   ` Kalle Valo
2020-11-07  8:08   ` Kalle Valo
2020-10-26 21:29 ` [PATCH net-next 10/11] ch_ktls: " Arnd Bergmann
2020-10-26 21:42   ` Andrew Lunn
2020-10-26 21:29 ` [PATCH net-next 11/11] ipv6: fix type mismatch warning Arnd Bergmann
2020-10-27  3:55 ` [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning Xie He
2020-10-27  4:02   ` Xie He
2020-10-27 13:23     ` Arnd Bergmann [this message]
2020-10-27 21:46       ` Xie He
2020-10-28  0:42 ` Jakub Kicinski
2020-10-28  8:35   ` Arnd Bergmann

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=CAK8P3a3JTg5Mi2XC9AEC+YwH552M_TXDY4BaULZz5WmEb3woRQ@mail.gmail.com \
    --to=arnd@kernel.org \
    --cc=3chas3@gmail.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=xie.he.0141@gmail.com \
    /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).