Received: by 10.223.185.116 with SMTP id b49csp1039947wrg; Fri, 16 Feb 2018 11:17:35 -0800 (PST) X-Google-Smtp-Source: AH8x2249uHeH/YaLtedaJo/f0Hw2dzySJOLr/cXZPz9oWKDnQdyfViEPNNCwclfNqMnMB04yM19t X-Received: by 10.99.65.133 with SMTP id o127mr5866589pga.13.1518808655006; Fri, 16 Feb 2018 11:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808654; cv=none; d=google.com; s=arc-20160816; b=XdPdCv+VOVXJAV0+KIpEwA4T3NA0MVtGyOfzlMY0tOZWyR5HkhdiUE0ShToNtfxJXd 7zvzcUYA1zo8MMV9lWgdCiteYcqsBRoPp6cOebzal2IrBDsAaPAesJaq43YZhOtVGNzi tfVOXev+eOrHRQIIXRPpd2TVRMv3CTn1VnQBfGJYntD1rLKQdjfq4BHGEhwFdKVW3Sy9 fS0ZDukjKGBc8Ng+3v4P8LmwgfrUj12oaNtALctL5gsCFgYP1H3jl/9hrC3rLaHA+7Ty XJV4sw6bGwpxv8049ReActFe/GLuFAYz1q3k2PLyV3A4xVF1DwFlYEcaCtXncoW6WMlV LZPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=1ewb+Qt7pEJ+nofm6MJ1uxB3sxPWEmXENswBJcQEOPw=; b=D1VpStZrt8DaXCOjqZtakxE/xxRg/zYQnQSYIYphQ9jXEHSZRqqtFhd7wh8GWqhJ38 7bQfFi1uqLYbyRXehZHJ+D5os3f8OYXRsdjYb1fAu9lB/rINl/wv5CENRsZUVIabYUfV Oqhnk+p3GBegmlnRtchQkFYGJmXMreS50R8N17dwBz7guPJzCx62rElChivrWMCJhGBh WUCRSEhTo0aDO/i9uAVYwgZ6U4RhxrupUlnGp1YQnvCdN3ixPHsnSdh9YQ0gkJAgTfRG f9wBtD1x1dKiEzYu/5dnGqSOlMJoi/BlbRImnrWP/gqr6j04j/0pVRMRrQJ3c3P+gXHJ 7QOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=iaVB5c0k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14-v6si1916810pls.623.2018.02.16.11.17.20; Fri, 16 Feb 2018 11:17:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=iaVB5c0k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030685AbeBPPzy (ORCPT + 99 others); Fri, 16 Feb 2018 10:55:54 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:57565 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030613AbeBPPzx (ORCPT ); Fri, 16 Feb 2018 10:55:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=1ewb+Qt7pEJ+nofm6MJ1uxB3sxPWEmXENswBJcQEOPw=; b=iaVB5c0kjBT35exPw4xl2+A8cCEZKfdZ1dbCTfAyWrwhSdO0FkUZW1H1O6Otdtx/HyIXRZAlEftV7Vf4SWUkbe8QbDTNZrqgBptvQof9UjhS1y9CzqHqL5QlyPEr1krN3lhnLlBU7t6QOFSO7KO4y0yNw+fdoujxQkQ9YlD1NP8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1emiMJ-0001e7-9s; Fri, 16 Feb 2018 16:55:35 +0100 Date: Fri, 16 Feb 2018 16:55:35 +0100 From: Andrew Lunn To: Richard Cochran Cc: "Gustavo A. R. Silva" , Brandon Streiff , Vivien Didelot , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] net: dsa: mv88e6xxx: hwtstamp: fix potential negative array index read Message-ID: <20180216155535.GE3080@lunn.ch> References: <20180215183139.GA23076@embeddedor.com> <20180216154846.7ge6seynwxjkopmp@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180216154846.7ge6seynwxjkopmp@localhost> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 16, 2018 at 07:48:46AM -0800, Richard Cochran wrote: > 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. > > NAK. Port is already known to be valid in the callers. Then we should take out the check. It is probably this check which is causing the false positives. Andrew