From patchwork Fri Oct 19 09:19:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 986640 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=embeddedor.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42c1GW0sr9z9s1x for ; Fri, 19 Oct 2018 20:44:35 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727175AbeJSRtw (ORCPT ); Fri, 19 Oct 2018 13:49:52 -0400 Received: from gateway22.websitewelcome.com ([192.185.46.229]:24888 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbeJSRtw (ORCPT ); Fri, 19 Oct 2018 13:49:52 -0400 X-Greylist: delayed 1499 seconds by postgrey-1.27 at vger.kernel.org; Fri, 19 Oct 2018 13:49:52 EDT Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 704F310DD for ; Fri, 19 Oct 2018 04:19:38 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id DQw8gnCZetz4jDQwLguNWZ; Fri, 19 Oct 2018 04:19:37 -0500 X-Authority-Reason: nr=8 Received: from lfbn-1-466-13.w86-245.abo.wanadoo.fr ([86.245.173.13]:50434 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gDQw7-000n6J-8H; Fri, 19 Oct 2018 04:19:15 -0500 Date: Fri, 19 Oct 2018 11:19:13 +0200 From: "Gustavo A. R. Silva" To: linux-kernel@vger.kernel.org Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Kishon Vijay Abraham I , "David S. Miller" , Quentin Schulz , netdev@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH v3 1/2] dt-bindings: phy: Update SERDES_MAX to be SERDES_MAX + 1 Message-ID: <5ae446d31ba33cb005d181b376ee650ab2f783e2.1539940387.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 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: 86.245.173.13 X-Source-L: No X-Exim-ID: 1gDQw7-000n6J-8H X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: lfbn-1-466-13.w86-245.abo.wanadoo.fr (embeddedor) [86.245.173.13]:50434 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 16 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 Reviewed-by: Quentin Schulz Acked-by: Rob Herring Signed-off-by: Gustavo A. R. Silva --- Changes in v3: - Post the patch to netdev. Changes in v2: - Add Quentin's Reviewed-by to commit log. - Add Rob's Acked-by to commit log. 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