From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752107AbdBFTIM (ORCPT ); Mon, 6 Feb 2017 14:08:12 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33437 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbdBFTIK (ORCPT ); Mon, 6 Feb 2017 14:08:10 -0500 Subject: Re: [PATCH net-next v5 3/4] net: phy: Allow pre-declaration of MDIO devices To: Andrew Lunn References: <20170204210245.14812-1-f.fainelli@gmail.com> <20170204210245.14812-4-f.fainelli@gmail.com> <20170206134808.GG32506@lunn.ch> Cc: netdev@vger.kernel.org, Jason Cooper , Sebastian Hesselbarth , Gregory Clement , Russell King , Vivien Didelot , "David S. Miller" , "moderated list:ARM/Marvell Dove/MV78xx0/Orion SOC support" , open list From: Florian Fainelli Message-ID: Date: Mon, 6 Feb 2017 11:08:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170206134808.GG32506@lunn.ch> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/06/2017 05:48 AM, Andrew Lunn wrote: >> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h >> index 8a57f0b1242d..8850fcaf50db 100644 >> --- a/include/linux/mod_devicetable.h >> +++ b/include/linux/mod_devicetable.h >> @@ -501,6 +501,7 @@ struct platform_device_id { >> kernel_ulong_t driver_data; >> }; >> >> +#define MDIO_NAME_SIZE 32 > > ... > >> +struct mdio_board_info { >> + const char *bus_id; >> + char modalias[MDIO_NAME_SIZE]; >> + > > I think it might be better to use MII_BUS_ID_SIZE. These are all > related, so using one define should avoid surprise buffer overruns, > truncation's. I considered doing that, but left it that way because I valued the "const" qualifier more than running out of buffer space. What I could do though, is change the strcmp() in drivers/net/phy/mdio-boardinfo.c to be bound by MII_BUS_ID_SIZE. -- Florian