From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH] net: Allow mac_pton() to work on non-NULL terminated strings Date: Fri, 23 Feb 2018 22:51:07 +0200 Message-ID: <1519419067.10722.139.camel@linux.intel.com> References: <20180223182006.GA2116@avx2> <20180223201748.14328-1-stefan@the2masters.de> <20180223204104.GA15686@avx2> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: andrew@lunn.ch, linux@arm.linux.org.uk, jason@lakedaemon.net, netdev@vger.kernel.org, "\[ 4 . 4+ \]" , linux-arm-kernel@lists.infradead.org, gregory.clement@free-electrons.com, dv@vollmann.ch To: Alexey Dobriyan , Stefan Hellermann Return-path: In-Reply-To: <20180223204104.GA15686@avx2> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org List-Id: netdev.vger.kernel.org On Fri, 2018-02-23 at 23:41 +0300, Alexey Dobriyan wrote: > On Fri, Feb 23, 2018 at 09:17:48PM +0100, Stefan Hellermann wrote: > > @@ -8,10 +8,6 @@ bool mac_pton(const char *s, u8 *mac) > > { > > int i; > > > > - /* XX:XX:XX:XX:XX:XX */ > > - if (strlen(s) < 3 * ETH_ALEN - 1) > > - return false; > > - > > /* Don't dirty result unless string is valid MAC. */ > > for (i = 0; i < ETH_ALEN; i++) { > > if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1])) > > Short string will bail in the loop, indeed. > > Reviewed-by: Alexey Dobriyan Since the author is okay with the change, I'm following: Reviewed-by: Andy Shevchenko -- Andy Shevchenko Intel Finland Oy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com ([134.134.136.126]:26791 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752445AbeBWUvL (ORCPT ); Fri, 23 Feb 2018 15:51:11 -0500 Message-ID: <1519419067.10722.139.camel@linux.intel.com> Subject: Re: [PATCH] net: Allow mac_pton() to work on non-NULL terminated strings From: Andy Shevchenko To: Alexey Dobriyan , Stefan Hellermann Cc: netdev@vger.kernel.org, andrew@lunn.ch, linux@arm.linux.org.uk, jason@lakedaemon.net, dv@vollmann.ch, gregory.clement@free-electrons.com, linux-arm-kernel@lists.infradead.org, "[ 4 . 4+ ]" Date: Fri, 23 Feb 2018 22:51:07 +0200 In-Reply-To: <20180223204104.GA15686@avx2> References: <20180223182006.GA2116@avx2> <20180223201748.14328-1-stefan@the2masters.de> <20180223204104.GA15686@avx2> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On Fri, 2018-02-23 at 23:41 +0300, Alexey Dobriyan wrote: > On Fri, Feb 23, 2018 at 09:17:48PM +0100, Stefan Hellermann wrote: > > @@ -8,10 +8,6 @@ bool mac_pton(const char *s, u8 *mac) > > { > > int i; > > > > - /* XX:XX:XX:XX:XX:XX */ > > - if (strlen(s) < 3 * ETH_ALEN - 1) > > - return false; > > - > > /* Don't dirty result unless string is valid MAC. */ > > for (i = 0; i < ETH_ALEN; i++) { > > if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1])) > > Short string will bail in the loop, indeed. > > Reviewed-by: Alexey Dobriyan Since the author is okay with the change, I'm following: Reviewed-by: Andy Shevchenko -- Andy Shevchenko Intel Finland Oy From mboxrd@z Thu Jan 1 00:00:00 1970 From: andriy.shevchenko@linux.intel.com (Andy Shevchenko) Date: Fri, 23 Feb 2018 22:51:07 +0200 Subject: [PATCH] net: Allow mac_pton() to work on non-NULL terminated strings In-Reply-To: <20180223204104.GA15686@avx2> References: <20180223182006.GA2116@avx2> <20180223201748.14328-1-stefan@the2masters.de> <20180223204104.GA15686@avx2> Message-ID: <1519419067.10722.139.camel@linux.intel.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, 2018-02-23 at 23:41 +0300, Alexey Dobriyan wrote: > On Fri, Feb 23, 2018 at 09:17:48PM +0100, Stefan Hellermann wrote: > > @@ -8,10 +8,6 @@ bool mac_pton(const char *s, u8 *mac) > > { > > int i; > > > > - /* XX:XX:XX:XX:XX:XX */ > > - if (strlen(s) < 3 * ETH_ALEN - 1) > > - return false; > > - > > /* Don't dirty result unless string is valid MAC. */ > > for (i = 0; i < ETH_ALEN; i++) { > > if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1])) > > Short string will bail in the loop, indeed. > > Reviewed-by: Alexey Dobriyan Since the author is okay with the change, I'm following: Reviewed-by: Andy Shevchenko -- Andy Shevchenko Intel Finland Oy