Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4115954imm; Mon, 8 Oct 2018 15:23:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV61/RLysMeVcTqC2QgUmnC1f2cWjZW5iOqKBBmuGYI3nYn6M55HNzRhp9hc5nVyj1ppLGf4j X-Received: by 2002:a63:1752:: with SMTP id 18-v6mr23327376pgx.131.1539037428188; Mon, 08 Oct 2018 15:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539037428; cv=none; d=google.com; s=arc-20160816; b=aYNYxkhxVH5k971CFw10NXGLS/TUOMI2oalP2SDfNVS/lkBZfgvar9AE0zuQYQ/CDY V6Ha/4jjG1p6iTBi+YiPvhA4LUqk6molYsGrFrCu6R2XEs1/xav9pfp3mtL0L2FDZJlC vfU27SynvI6xpa/svqVNToAyNHxSR4TqEJWjJkp1lOBTKZVfhalD5vbCKgz7W4kVWBFZ rv15ay7fDdhaYh422qYKAZtwQFgS978OoI+eqr9eULpgpmJkVIAD+LrV2uWnzVTG4bBa 7AX16gAvyYaUZlh5c5F1U3EoeydjYe/nfzffUaDkHno59RIifPd27e5OI4PoYq1ighT4 rsJQ== 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; bh=eML3xAWu4Vu4bkJl+VCwhpsdJoSF8tIRLoJNy+Zh2CQ=; b=STbRYS+ucqhF30LPiM2QA9m/+sEZyvXNZ09sdL/LS/VVYYvehLCaDVVk/Zl/RLy/in j0wwQicBxkSN6RJfOU+7inlRIpPlrc4TUlgxXPY9NvK+SKumlXJPyNQwtX0cPoyjGOLc A21T99AomKInD5h4jjqkFz6MT/8Hg/UBts6inYF5BuVa4HDxFPWEGV6hG55zKcG1YlC7 1WHCCWL1UwxScaPhhV89+m4ashtTAvQnkmHzB4R8f11bqFcFyEvNVqyYXQCnM0LOLpTa usI3LFX6y15hqoaS7cFohP805d93WRHDHheswsNZCI79nVxpUBQHh9zawYPcq+xLsUoJ +ayA== ARC-Authentication-Results: i=1; mx.google.com; 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 u13-v6si19782886pfl.129.2018.10.08.15.23.33; Mon, 08 Oct 2018 15:23:48 -0700 (PDT) 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; 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 S1726717AbeJIFff (ORCPT + 99 others); Tue, 9 Oct 2018 01:35:35 -0400 Received: from gateway22.websitewelcome.com ([192.185.47.79]:41918 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbeJIFff (ORCPT ); Tue, 9 Oct 2018 01:35:35 -0400 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway22.websitewelcome.com (Postfix) with ESMTP id DFF951C1BD for ; Mon, 8 Oct 2018 17:21:39 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 9duEg09FY8YaU9duFgS37w; Mon, 08 Oct 2018 17:21:39 -0500 X-Authority-Reason: nr=8 Received: from 174.206.93.92.rev.sfr.net ([92.93.206.174]:53278 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1g9duD-0026cK-Vw; Mon, 08 Oct 2018 17:21:38 -0500 Date: Tue, 9 Oct 2018 00:21:36 +0200 From: "Gustavo A. R. Silva" To: Rob Herring , Mark Rutland Cc: linux-kernel@vger.kernel.org, Quentin Schulz , "Gustavo A. R. Silva" , devicetree@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: phy: Update SERDES_MAX to be SERDES_MAX + 1 Message-ID: <3a1a95a4832af33dcd1842b0298d257bbcf1f5ab.1539036280.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 92.93.206.174 X-Source-L: No X-Exim-ID: 1g9duD-0026cK-Vw X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174.206.93.92.rev.sfr.net (embeddedor) [92.93.206.174]:53278 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 9 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SERDES_MAX is a valid value to index ctrl->phys in drivers/phy/mscc/phy-ocelot-serdes.c. But, currently, there is an out-of-bounds bug in the mentioned driver when reading from ctrl->phys, because the size of array ctrl->phys is SERDES_MAX. Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1. Notice that this is the first part of the solution to the out-of-bounds bug mentioned above. Although this change is not dependent on any other one. Suggested-by: Quentin Schulz Signed-off-by: Gustavo A. R. Silva --- include/dt-bindings/phy/phy-ocelot-serdes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dt-bindings/phy/phy-ocelot-serdes.h b/include/dt-bindings/phy/phy-ocelot-serdes.h index bd28f21..fe70ada 100644 --- a/include/dt-bindings/phy/phy-ocelot-serdes.h +++ b/include/dt-bindings/phy/phy-ocelot-serdes.h @@ -7,6 +7,6 @@ #define SERDES1G_MAX SERDES1G(5) #define SERDES6G(x) (SERDES1G_MAX + 1 + (x)) #define SERDES6G_MAX SERDES6G(2) -#define SERDES_MAX SERDES6G_MAX +#define SERDES_MAX (SERDES6G_MAX + 1) #endif -- 2.7.4