netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: sr@denx.de
Cc: netdev@vger.kernel.org, opensource@vdorst.com,
	daniel@makrotopia.org, sean.wang@mediatek.com, john@phrozen.org
Subject: Re: [PATCH net-next 4/4 v2] net: ethernet: mediatek: Add MT7628/88 SoC support
Date: Thu, 15 Aug 2019 16:36:48 -0700 (PDT)	[thread overview]
Message-ID: <20190815.163648.1684648819390926444.davem@davemloft.net> (raw)
In-Reply-To: <20190814111825.10855-4-sr@denx.de>

From: Stefan Roese <sr@denx.de>
Date: Wed, 14 Aug 2019 13:18:25 +0200

> +static int txd_to_idx(struct mtk_tx_ring *ring, struct mtk_tx_dma *dma)
> +{
> +	return ((u32)dma - (u32)ring->dma) / sizeof(*dma);
> +}

This will definitely warn on 64-bit, and you should avoid that even if this
driver can not possibly be built on 64-bit platforms.

You cannot truncate a pointer to an integer which is potentially smaller
in representation size than a pointer could potentially be.

Just can avoid all of these issues by using real pointer arithmetic and
casting to (char *), or even better, (void *).

      reply	other threads:[~2019-08-15 23:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 11:18 [PATCH net-next 1/4 v2] dt-bindings: net: mediatek: Add support for MediaTek MT7628/88 SoC Stefan Roese
2019-08-14 11:18 ` [PATCH net-next 2/4 v2] net: ethernet: mediatek: Rename MTK_QMTK_INT_STATUS to MTK_QDMA_INT_STATUS Stefan Roese
2019-08-14 11:18 ` [PATCH net-next 3/4 v2] net: ethernet: mediatek: Rename NEXT_RX_DESP_IDX to NEXT_DESP_IDX Stefan Roese
2019-08-14 11:18 ` [PATCH net-next 4/4 v2] net: ethernet: mediatek: Add MT7628/88 SoC support Stefan Roese
2019-08-15 23:36   ` David Miller [this message]

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=20190815.163648.1684648819390926444.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=daniel@makrotopia.org \
    --cc=john@phrozen.org \
    --cc=netdev@vger.kernel.org \
    --cc=opensource@vdorst.com \
    --cc=sean.wang@mediatek.com \
    --cc=sr@denx.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).