Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760200AbcJRNGL (ORCPT ); Tue, 18 Oct 2016 09:06:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:45817 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755067AbcJRNGC (ORCPT ); Tue, 18 Oct 2016 09:06:02 -0400 Date: Tue, 18 Oct 2016 15:05:59 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Arnd Bergmann cc: Linus Torvalds , linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Luis R. Rodriguez" Subject: Re: [PATCH 22/28] x86: apm: avoid uninitialized data In-Reply-To: <20161017221650.1902729-3-arnd@arndb.de> Message-ID: References: <20161017220342.1627073-1-arnd@arndb.de> <20161017221650.1902729-3-arnd@arndb.de> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 Content-Length: 1172 Lines: 30 On Tue, 18 Oct 2016, Arnd Bergmann wrote: > apm_bios_call() can fail, and return a status in its argument > structure. If that status however is zero during a call from > apm_get_power_status(), we end up using data that may have > never been set, as reported by "gcc -Wmaybe-uninitialized": > > arch/x86/kernel/apm_32.c: In function ‘apm’: > arch/x86/kernel/apm_32.c:1729:17: error: ‘bx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > arch/x86/kernel/apm_32.c:1835:5: error: ‘cx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > arch/x86/kernel/apm_32.c:1730:17: note: ‘cx’ was declared here > arch/x86/kernel/apm_32.c:1842:27: error: ‘dx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > arch/x86/kernel/apm_32.c:1731:17: note: ‘dx’ was declared here > > This changes the function to return "APM_NO_ERROR" here, which > makes the code more robust to broken BIOS versions, and avoids > the warning. > > Cc: x86@kernel.org > Signed-off-by: Arnd Bergmann Makes sense. Reviewed-by: Jiri Kosina Thanks, -- Jiri Kosina SUSE Labs