Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1350547 > unrolled thread

Re: [PATCH] stmmac: Fix type of local variable in stmmac_xmit

Started byDavid Miller <davem@davemloft.net>
First post2016-03-04 20:40 +0100
Last post2016-03-04 20:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] stmmac: Fix type of local variable in stmmac_xmit David Miller <davem@davemloft.net> - 2016-03-04 20:40 +0100

#1350547 — Re: [PATCH] stmmac: Fix type of local variable in stmmac_xmit

FromDavid Miller <davem@davemloft.net>
Date2016-03-04 20:40 +0100
SubjectRe: [PATCH] stmmac: Fix type of local variable in stmmac_xmit
Message-ID<r93JW-37d-43@gated-at.bofh.it>
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.

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web