Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1060814rwl; Wed, 29 Mar 2023 12:04:04 -0700 (PDT) X-Google-Smtp-Source: AKy350b2VDmNWKjXiOkURS9KlWvsGiEctxi5I5vSHe3vty4lcsgl2mwIbjzHkct2QGSkHqcwdy91 X-Received: by 2002:a62:7b51:0:b0:625:1487:f06c with SMTP id w78-20020a627b51000000b006251487f06cmr19386025pfc.29.1680116644679; Wed, 29 Mar 2023 12:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680116644; cv=none; d=google.com; s=arc-20160816; b=Ajn6rWlVJs3q5mGiVc5UstbBUyi0fl6pnX06KKoY5/yxpQdr8nzv+RLxP0wg2MchmM Hv5VpXfmdonvDi3d+sq6x++LUBzgr03qJwfBwP+dVvRPcNxKPioCWyXnLdGSgMv5MeH+ q9PLVouQ0+JKZ3FQqTQt/yCyUHIuiX+XjYqIYeApu7N7dROb8cUH/mjVSP2MB5Pj0871 7voKSMR9MDbGz5HW3K3OhuMoGMxmd4kCFd5lk4dqHYZyJl0W1zq6/a6gurrJfsKEuOvr 1gm+yb9jqr7YjqbdATERwSYxLAN7R22EGOpugiyiTT26/PMbFzxqfVUsLHFn2Cxj+LtN HUnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=E+SrphCLdThZzlLiNXMgD18n1uKBII6JQBPtow2c/Yc=; b=RJKpLCHwnctSRVPjwfUEKSTVsUV2Hn6ppc8QVs6JzYlVExX7JxlSFaaOruqEe48Qdb 6S3OnDaFhcyxpPKmdSxfU1MRw76wUJ0S6NZnsoW7CO2tucUFbneWkb3wNM3Q66nCiD8A 3tpQ78gyxHCYH6y9qXWWM7bUFFU7xz7YTWkNQ30MrKbwnoadS5oTYhvf6DXPkKN7GMhp 4k6T9QNYpHw4kynOEQlU0TYtpOK2yRHu07c8HvBarngez5MNKHrfW4rj/f56iLnAjGiG BcloOllgTa/gm/40JPXvss4D40Vb4SaCW67di4ICWyOdsGia66A74wC36Z+98pOKFgqJ fQIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hsPi2Uet; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x69-20020a638648000000b005135ac02ca6si6929080pgd.135.2023.03.29.12.03.51; Wed, 29 Mar 2023 12:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hsPi2Uet; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbjC2S7Q (ORCPT + 99 others); Wed, 29 Mar 2023 14:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjC2S7O (ORCPT ); Wed, 29 Mar 2023 14:59:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20660359B; Wed, 29 Mar 2023 11:59:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A295761DF4; Wed, 29 Mar 2023 18:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B59EC433EF; Wed, 29 Mar 2023 18:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680116352; bh=xrNis/Gi3YDSlD/DO7oEOemdsc4Il0XaJqIaosSVJRc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hsPi2UetoUMlw5hSiothNL2dKs8N+efFzVfRSgV7i/z2uZzrzycMAemEsfDnwTwlD poGVFn0d0aaYYZKC0yZjaSYY24HI2AiQcYVqjJqeIAk9CXqt5Ov4DR++dC112i0Atm KTPy9GKBL8/OrhVfyPBXFs1pmMw3Ytvx7gXWJJb6kxeBHGQgwmoI4qsu6G07W0R7Ys fmlritIEb/Fg394yCazQAhZqw6lIrb6NzI2clFiArLntkAJUgubrt9eqThnbZKd1JM J9USc/MH1i5FSzrx+Rk2EDMJoG1TmSJlOnhX4jp3z3GmbT/q9swr4/yxKRKsJ7VYP6 p0QhlzZMl9UDw== Date: Wed, 29 Mar 2023 21:59:07 +0300 From: Leon Romanovsky To: Denis Plotnikov Cc: GR-Linux-NIC-Dev@marvell.com, manishc@marvell.com, rahulv@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Subject: Re: [PATCH] net: netxen: report error on version offset reading Message-ID: <20230329185907.GE831478@unreal> References: <20230329162629.96590-1-den-plotnikov@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230329162629.96590-1-den-plotnikov@yandex-team.ru> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 29, 2023 at 07:26:29PM +0300, Denis Plotnikov wrote: > A static analyzer complains for non-checking the function returning value. > Although, the code looks like not expecting any problems with version > reading on netxen_p3_has_mn call, it seems the error still may happen. > So, at least, add error reporting to ease problems investigation. > > Signed-off-by: Denis Plotnikov > --- > drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c > index 35ec9aab3dc7b..92962dbb73ad0 100644 > --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c > +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c > @@ -1192,8 +1192,13 @@ netxen_p3_has_mn(struct netxen_adapter *adapter) > if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) > return 1; > > - netxen_rom_fast_read(adapter, > - NX_FW_VERSION_OFFSET, (int *)&flashed_ver); > + if (netxen_rom_fast_read(adapter, > + NX_FW_VERSION_OFFSET, (int *)&flashed_ver)) { 1. Mo callers of netxen_rom_fast_read() print debug messages, so this shouldn't too. 2. netxen_p3_has_mn() can't fail and by returning 0, you will cause to unpredictable behaviour in netxen_validate_firmware(). Thanks > + printk(KERN_ERR "%s: ERROR on flashed version reading", > + netxen_nic_driver_name); > + return 0; > + } > + > flashed_ver = NETXEN_DECODE_VERSION(flashed_ver); > > if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { > -- > 2.25.1 >