mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: a.hajda@samsung.com
Cc: peppe.cavallaro@st.com, netdev@vger.kernel.org,
	b.zolnierkie@samsung.com, m.szyprowski@samsung.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] stmmac: Fix type of local variable in stmmac_xmit
Date: Fri, 04 Mar 2016 14:31:10 -0500 (EST)	[thread overview]
Message-ID: <20160304.143110.200519699910396294.davem@davemloft.net> (raw)
In-Reply-To: <1457075944-6959-1-git-send-email-a.hajda@samsung.com>

From: Andrzej Hajda <a.hajda@samsung.com>
Date: Fri, 04 Mar 2016 08:19:04 +0100

> Variable entry holds result of jumbo_frm callback. It can be negative,
> so the variable should be signed. The patch changes also type of related
> first_entry variable to make code compact and coherent.
> 
> The problem has been detected using patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Actually, this only papers over a much deeper problem.

You cannot mix continually incrementing indexes with negative
return values.

You simply can't.

Because after enough traffic the legitimate indexes will be negative
integer values, so this jumbo index test would alway trigger.

A better fix is needed for this.  ->jumbo_frm() cannot return a value
that is interpreted both as an index as well as an error code.  The
dual signalling between these two values is simply impossible because
one the whole value space of a 32-bit integer is also a valid index.

      reply	other threads:[~2016-03-04 19:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  7:19 Andrzej Hajda
2016-03-04 19:31 ` 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=20160304.143110.200519699910396294.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=a.hajda@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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

all inboxes | Powered by JetHome®