From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759748AbcCDTbN (ORCPT ); Fri, 4 Mar 2016 14:31:13 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:35102 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752942AbcCDTbM (ORCPT ); Fri, 4 Mar 2016 14:31:12 -0500 Date: Fri, 04 Mar 2016 14:31:10 -0500 (EST) Message-Id: <20160304.143110.200519699910396294.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 From: David Miller In-Reply-To: <1457075944-6959-1-git-send-email-a.hajda@samsung.com> References: <1457075944-6959-1-git-send-email-a.hajda@samsung.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 04 Mar 2016 11:31:11 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrzej Hajda 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 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.