From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH v2] net: dsa: mv88e6xxx: hwtstamp: fix potential negative array index read Date: Thu, 15 Feb 2018 22:12:51 +0100 Message-ID: <20180215211251.GC3080@lunn.ch> References: <20180215183139.GA23076@embeddedor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Brandon Streiff , Vivien Didelot , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: "Gustavo A. R. Silva" Return-path: Content-Disposition: inline In-Reply-To: <20180215183139.GA23076@embeddedor.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Feb 15, 2018 at 12:31:39PM -0600, Gustavo A. R. Silva wrote: > _port_ is being used as index to array port_hwtstamp before verifying > it is a non-negative number and a valid index at line 209 and 258: > > if (port < 0 || port >= mv88e6xxx_num_ports(chip)) > > Fix this by checking _port_ before using it as index to array > port_hwtstamp. > > Addresses-Coverity-ID: 1465287 ("Negative array index read") > Addresses-Coverity-ID: 1465291 ("Negative array index read") > Fixes: c6fe0ad2c349 ("net: dsa: mv88e6xxx: add rx/tx timestamping support") > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Andrew Lunn Andrew