Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752857AbdLMLrZ (ORCPT ); Wed, 13 Dec 2017 06:47:25 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47938 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751853AbdLMLrY (ORCPT ); Wed, 13 Dec 2017 06:47:24 -0500 Date: Wed, 13 Dec 2017 12:47:28 +0100 From: Greg Kroah-Hartman To: Nicolas Iooss Cc: Hans de Goede , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] staging: rtl8723bs: make memcmp() calls consistent Message-ID: <20171213114728.GB21746@kroah.com> References: <20171210193512.6309-1-nicolas.iooss_linux@m4x.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171210193512.6309-1-nicolas.iooss_linux@m4x.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 806 Lines: 23 On Sun, Dec 10, 2017 at 08:35:12PM +0100, Nicolas Iooss wrote: > rtw_pm_set() uses memcmp() with 5-chars strings and a length of 4 when > parsing extra, and then parses extra+4 as an int: > > if (!memcmp(extra, "lps =", 4)) { > sscanf(extra+4, "%u", &mode); > /* ... */ > } else if (!memcmp(extra, "ips =", 4)) { > sscanf(extra+4, "%u", &mode); > > The space between the key ("lps" and "ips") and the equal sign seems > suspicious. Remove it in order to make the calls to memcmp() consistent. But you now just changing the parsing logic. What broke because of this? Did you test this codepath with your patch? I'm not disagreeing that this code seems really odd, but it must be working as-is for someone, to change this logic will break their system :( thanks, greg k-h