From: Michael Chan <michael.chan@broadcom.com>
To: George Spelvin <lkml@sdf.org>
Cc: Netdev <netdev@vger.kernel.org>, Hauke Mehrtens <hauke@hauke-m.de>
Subject: Re: [RFC PATCH 2/4] b44: Fix off-by-one error in acceptable address range
Date: Mon, 9 Dec 2019 09:29:46 -0800 [thread overview]
Message-ID: <CACKFLinCFmEPHzaQRy0Wq_pjWtA+n_Uu9D63t1oEjtQM=1yMHQ@mail.gmail.com> (raw)
In-Reply-To: <201912080836.xB88amHd015549@sdf.org>
On Sun, Dec 8, 2019 at 12:36 AM George Spelvin <lkml@sdf.org> wrote:
>
> The requirement is dma_addr + size <= 0x40000000, not 0x3fffffff.
>
> In a logically separate but overlapping change, this patch also
> rearranges the logic for detecting failures to use a goto rather
> than testing dma_mapping_error() twice. The latter is expensive if
> CONFIG_DMA_API_DEBUG is set, but also for bug-proofing reasons I try to
> avoid having the same condition in two places that must be kept in sync.
>
> Signed-off-by: George Spelvin <lkml@sdf.org>
> ---
> drivers/net/ethernet/broadcom/b44.c | 42 ++++++++++++++++-------------
> 1 file changed, 24 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index 394671230c1c..e540d5646aef 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -680,12 +680,13 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
>
> /* Hardware bug work-around, the chip is unable to do PCI DMA
> to/from anything above 1GB :-( */
> - if (dma_mapping_error(bp->sdev->dma_dev, mapping) ||
> - mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)) {
> + if (dma_mapping_error(bp->sdev->dma_dev, mapping))
> + goto workaround;
> + if (mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)+1) {
The patchset looks ok to me. The only minor suggestion is to define
this (DMA_BIT_MASK(30) + 1) as B44_DMA_ADDR_LIMIT or something like
that so you don't have to repeat it so many times.
Thanks.
next prev parent reply other threads:[~2019-12-09 17:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-08 8:36 [RFC PATCH 2/4] b44: Fix off-by-one error in acceptable address range George Spelvin
2019-12-09 17:29 ` Michael Chan [this message]
2019-12-09 18:01 ` George Spelvin
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='CACKFLinCFmEPHzaQRy0Wq_pjWtA+n_Uu9D63t1oEjtQM=1yMHQ@mail.gmail.com' \
--to=michael.chan@broadcom.com \
--cc=hauke@hauke-m.de \
--cc=lkml@sdf.org \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).