From patchwork Wed Jun 20 07:27:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: santosh nayak X-Patchwork-Id: 165907 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AB09AB6FC2 for ; Wed, 20 Jun 2012 17:27:59 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753616Ab2FTH15 (ORCPT ); Wed, 20 Jun 2012 03:27:57 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:41089 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052Ab2FTH14 (ORCPT ); Wed, 20 Jun 2012 03:27:56 -0400 Received: by pbbrp8 with SMTP id rp8so240748pbb.19 for ; Wed, 20 Jun 2012 00:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=Egybz/KjnswVtZD9+1dcVi6iGzqOyKmVmgAOkvwghw4=; b=A19L1x/3JLLo32EOTyo2ErAoHDTdfOnA1gWgOYzr1L7AJGbwrBbuIb9zUkaH8uL/2/ iMaZHBfPU5B17+AtKWOgzgzjUE7LDyLV42UL5AoaT/nQceo+s3jTKKQNZDR6HTHWd2rw SZ694+cOMaXZhVKbhvUQ/n2W0VLQEYczFgeAaO/W7FpSlzGPhYYabVSN9uC4DE7CPtQ5 ps6xrIbkj1SkJkw3JHrNAym8/LHrqPw7QTIRORrceJHX/x1bhsMqsrikhzzVhm6C7YYl x3KN17q1cEfwfNFiksHisSoVdWNM2ipeJ5j8uqauyQqL+uDAzenRtya/i7MgECnPuuRL Kg1w== Received: by 10.68.136.68 with SMTP id py4mr31760879pbb.151.1340177275703; Wed, 20 Jun 2012 00:27:55 -0700 (PDT) Received: from localhost.localdomain ([64.103.156.72]) by mx.google.com with ESMTPS id ru4sm30913091pbc.66.2012.06.20.00.27.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 00:27:55 -0700 (PDT) From: santosh nayak To: sony.chacko@qlogic.com, rajesh.borundia@qlogic.com Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Santosh Nayak Subject: [PATCH] netxen: Error return off by one in 'netxen_nic_set_pauseparam()'. Date: Wed, 20 Jun 2012 12:57:39 +0530 Message-Id: <1340177259-14083-1-git-send-email-santoshprasadnayak@gmail.com> X-Mailer: git-send-email 1.7.4.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Santosh Nayak There are 'NETXEN_NIU_MAX_GBE_PORTS' GBE ports. Port indexing starts from zero. Hence we should also return error for "port == NETXEN_NIU_MAX_GBE_PORTS" Signed-off-by: Santosh Nayak --- Destination tree "linux-next" .../ethernet/qlogic/netxen/netxen_nic_ethtool.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c index 3973040..d4f179f 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c @@ -489,7 +489,7 @@ netxen_nic_get_pauseparam(struct net_device *dev, int port = adapter->physical_port; if (adapter->ahw.port_type == NETXEN_NIC_GBE) { - if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) + if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS)) return; /* get flow control settings */ val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port)); @@ -534,7 +534,7 @@ netxen_nic_set_pauseparam(struct net_device *dev, int port = adapter->physical_port; /* read mode */ if (adapter->ahw.port_type == NETXEN_NIC_GBE) { - if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) + if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS)) return -EIO; /* set flow control */ val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));