From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758526Ab3GRHEi (ORCPT ); Thu, 18 Jul 2013 03:04:38 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:55481 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756654Ab3GRHEg (ORCPT ); Thu, 18 Jul 2013 03:04:36 -0400 MIME-Version: 1.0 In-Reply-To: <20130717.182237.906875287830581782.davem@davemloft.net> References: <1374063905-4050-1-git-send-email-geert@linux-m68k.org> <20130717.182237.906875287830581782.davem@davemloft.net> Date: Thu, 18 Jul 2013 09:04:36 +0200 X-Google-Sender-Auth: o6vNRNwuVXJ87NI7ZGDmlHjz5RE Message-ID: Subject: Re: [PATCH] net/sun3_82586: Kill array subscript above array bounds warning From: Geert Uytterhoeven To: David Miller Cc: Sam Creasey , "netdev@vger.kernel.org" , "Linux/m68k" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 18, 2013 at 3:22 AM, David Miller wrote: >> drivers/net/ethernet/i825xx/sun3_82586.c: In function 'sun3_82586_timeout': >> drivers/net/ethernet/i825xx/sun3_82586.c:993:89: warning: array subscript is above array bounds [-Warray-bounds] >> >> Using the default NUM_XMIT_BUFFS = 1, there's only one transmit buffer. >> Hence accessing the second buffer is an out-of-bounds access. >> Print the command status of the first NOP buffer instead. >> >> Fortunately this actually worked fine, as the layout of transmit and NOP >> buffers is sufficiently similar. >> >> Signed-off-by: Geert Uytterhoeven > > Three more CPP directives in a DEBUG ifdef'd piece of code, yuck. > > I'd say just kill this whole DEBUG section entirely. If people > want this driver to print this debugging, do it properly with > netif_err() or similar. Yeah, this driver could use some major cleanup. I had to protect my eyes while fixing the compiler warning. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds