From patchwork Fri Jul 14 12:07:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107795 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp892735obm; Fri, 14 Jul 2017 05:13:30 -0700 (PDT) X-Received: by 10.84.213.9 with SMTP id f9mr15508215pli.22.1500034410565; Fri, 14 Jul 2017 05:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500034410; cv=none; d=google.com; s=arc-20160816; b=K2vLTUzz7gPWiFjW4h4CXLeQrvQS7dToPFjbraDwoOuKehsZoBt8GK70lDtHVZ84yb FLfSQPRv3LHZ+5lDeNo95LmIuZu1lmqllzx//v3VMXbDj3yvLTtTMXNNLBmS5bkkp6Ki 7YW8xOEH9+MERLNkmPH5SBf6spFOE5m9knmV07901CUwspL7bRYIh0FzJUTk/FzjPBe2 qaS/2HBJij7F1rG9w+fGSMG2O3Ueb3CdnaMHJOGETa+EEZ/rEnbIjFVqiRSxbiW9klzz tYE2y+IiikGhqRDJvjvNKB3vKoyuySLf70tbVJVN7/5YvhD4agPD9OMaUPaZe7Gtg24L 6A+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZEps2EWb2Wd9JdCii+wlORN8NbXuBCJOdYuTnZmNqsw=; b=k6JxZtqQAlOM9kg4GrP+GzhiMC31zO6hqjKmxz+wP42g/o4LCSTlACKTSR1dIOgwto 6y2Xwdwp3A6nqJbZ7+Gy0l/fJosZSy4WZsgXgTx1K7L3TapQ+eHEKxwu4TPWqRjv6rAo tRY5JZC6/HJ+diYYOC8d/dVb9e5DdAvBIDl0xsjXWYgmnnE1/rQRn18ukTOLVdY1Z9xJ peMbCDtKJtSoRt0xrNVOlSQxVs65+GOgQxNFnoh1ksAJ2ev2WsC9B/nU/GUPB8laLezZ 31BZwkLM9o2mnqVubmdivPwN9RKG2PJUFD14+L6BYInb7EdZe3gDPvSnazohnpBUuWX/ W4DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si6245147pgc.233.2017.07.14.05.13.30; Fri, 14 Jul 2017 05:13:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932231AbdGNMN0 (ORCPT + 25 others); Fri, 14 Jul 2017 08:13:26 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:59521 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbdGNMNW (ORCPT ); Fri, 14 Jul 2017 08:13:22 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0MC1A0-1dN9jt3sxM-008sgp; Fri, 14 Jul 2017 14:11:38 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Darren Hart , Andy Shevchenko Cc: Greg Kroah-Hartman , Linus Torvalds , Guenter Roeck , akpm@linux-foundation.org, netdev@vger.kernel.org, "David S . Miller" , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, x86@kernel.org, Arnd Bergmann , Mario Limonciello , Arvind Yadav , platform-driver-x86@vger.kernel.org Subject: [PATCH 17/22] platform/x86: alienware-wmi: fix format string overflow warning Date: Fri, 14 Jul 2017 14:07:09 +0200 Message-Id: <20170714120720.906842-18-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714120720.906842-1-arnd@arndb.de> References: <20170714120720.906842-1-arnd@arndb.de> X-Provags-ID: V03:K0:4XOtuPAALKuS8DxTM63tcbwL/8NN7O+VNaaO6IXY6yExvaKs9+q fWY2mugP7xyQbW0zj+EObM2c92gx7ooN3s1U1zISxWscIUNvoQRnKyY8cPwpnpFJCVyKnNi xgBlP4ItAiHHzLnKaokDKlfS2WynwCcDb1aZzYO3moOl9zYpAxcMfiJ4tVk1pDKt9GHMmTA KjB4noAhvFZAyliZHyZwg== X-UI-Out-Filterresults: notjunk:1; V01:K0:BJ57ShxF6VI=:L5QQmo8R5VBld6R39q0TU4 kp/LlEYlQ+riAvJ0clOxpBbc1VmU5QgJExe2lEyHC26qyd82l+a6ojUu7XXD8svC/VQUr3Van K2rBCXI09zlpDCPEgFFiOHfImcuiQlHPD/BL4VW0aH+Zz2VPR20GtqzLORIjqZHBtxDV4zUzW 6OCz1+Pw+16RVoXSR48OTE4nu0PF3oZfnG8o0ckxiStJkXyBmNpO+7TLmAKxsarLWQs+fczKK 4JWI0Ex4csElmdBQP2E79Lwtp8F9hU0+nz/ZdE3MnAkqlBIg/BoYK58ArsDf2NsISBvxFM80/ L0c754AluW2rabgrNlPU9BBeIwaBCn+HhSw/EaFDf0xSjb16f0k2LO3UxQLFnYDBni6MGRrU+ lbXBKdvRZKUdKOnpwIJTzj856RPrwrnn2nsdGV7kdJNLXFN1Me5/bZ9+sVYb3rZBYOVhWTSra ty+A6fMi5xVwRVKrHOYHQbhrYmhJftb6pliBs1m9uvVMWYN8h53/NwAra8tCn3htySfi/GXeD vwbaec6p/voorH9LiN7VDwTaXmMZMXRjrnEQDAwzpVImkZqyFNfHmWSaHQYWfnu9WzSMr8QnM /pj2hvPyCoyzvpExfYw1qFOij8imdbQDx/dmGyWRWfiDd9dgn8LsTC4OBw7PyAPE3qczWNNdN wREjMiAOJqzjDqDEIxW6sWzJmt9mqhkv2U5KVqFrDrA7GTP7kfNWtKoAr+5xB3LuGBfGW9TU+ LKK4LZazIWdbJFpCcSqVUWlpCLhE+QUkpaXSOA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc points out a possible format string overflow for a large value of 'zone': drivers/platform/x86/alienware-wmi.c: In function 'alienware_wmi_init': drivers/platform/x86/alienware-wmi.c:461:24: error: '%02X' directive writing between 2 and 8 bytes into a region of size 6 [-Werror=format-overflow=] sprintf(buffer, "zone%02X", i); ^~~~ drivers/platform/x86/alienware-wmi.c:461:19: note: directive argument in the range [0, 2147483646] sprintf(buffer, "zone%02X", i); ^~~~~~~~~~ drivers/platform/x86/alienware-wmi.c:461:3: note: 'sprintf' output between 7 and 13 bytes into a destination of size 10 While the zone should never be that large, it's easy to make the buffer a few bytes longer so gcc can prove this to be safe. Signed-off-by: Arnd Bergmann --- drivers/platform/x86/alienware-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 Signed-off-by: Mario Limonciello diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c index 0831b428c217..acc01242da82 100644 --- a/drivers/platform/x86/alienware-wmi.c +++ b/drivers/platform/x86/alienware-wmi.c @@ -421,7 +421,7 @@ static DEVICE_ATTR(lighting_control_state, 0644, show_control_state, static int alienware_zone_init(struct platform_device *dev) { int i; - char buffer[10]; + char buffer[13]; char *name; if (interface == WMAX) {