Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752377AbdLJTfd (ORCPT ); Sun, 10 Dec 2017 14:35:33 -0500 Received: from mx1.polytechnique.org ([129.104.30.34]:54567 "EHLO mx1.polytechnique.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbdLJTfa (ORCPT ); Sun, 10 Dec 2017 14:35:30 -0500 From: Nicolas Iooss To: Greg Kroah-Hartman , Hans de Goede , devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org, Nicolas Iooss Subject: [PATCH 1/1] staging: rtl8723bs: make memcmp() calls consistent Date: Sun, 10 Dec 2017 20:35:12 +0100 Message-Id: <20171210193512.6309-1-nicolas.iooss_linux@m4x.org> X-Mailer: git-send-email 2.15.0 X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Dec 10 20:35:28 2017 +0100 (CET)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.048749, queueID=73E375646DF Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1314 Lines: 36 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. Signed-off-by: Nicolas Iooss --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 3fca0c2d4c8d..ffcfefefc898 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -4561,10 +4561,10 @@ static int rtw_pm_set(struct net_device *dev, DBG_871X("[%s] extra = %s\n", __func__, extra); - if (!memcmp(extra, "lps =", 4)) { + if (!memcmp(extra, "lps=", 4)) { sscanf(extra+4, "%u", &mode); ret = rtw_pm_set_lps(padapter, mode); - } else if (!memcmp(extra, "ips =", 4)) { + } else if (!memcmp(extra, "ips=", 4)) { sscanf(extra+4, "%u", &mode); ret = rtw_pm_set_ips(padapter, mode); } else { -- 2.15.0