From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751294AbdIPG4y (ORCPT ); Sat, 16 Sep 2017 02:56:54 -0400 Received: from mga05.intel.com ([192.55.52.43]:28779 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbdIPG4x (ORCPT ); Sat, 16 Sep 2017 02:56:53 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,400,1500966000"; d="scan'208";a="900820698" Date: Sat, 16 Sep 2017 09:56:49 +0300 From: Mika Westerberg To: Arnd Bergmann Cc: "Rafael J. Wysocki" , Len Brown , Ryan Kennedy , Guenter Roeck , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] acpi: watchdog: properly initialize resources Message-ID: <20170916065649.GK2477@lahna.fi.intel.com> References: <20170915195526.1541309-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170915195526.1541309-1-arnd@arndb.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 15, 2017 at 09:55:18PM +0200, Arnd Bergmann wrote: > We copy a local resource structure into a list, but only > initialize some of its members, as pointed out by gcc-4.4: > > drivers/acpi/acpi_watchdog.c: In function 'acpi_watchdog_init': > drivers/acpi/acpi_watchdog.c:105: error: 'res.child' may be used uninitialized in this function > drivers/acpi/acpi_watchdog.c:105: error: 'res.sibling' may be used uninitialized in this function > drivers/acpi/acpi_watchdog.c:105: error: 'res.parent' may be used uninitialized in this function > drivers/acpi/acpi_watchdog.c:105: error: 'res.desc' may be used uninitialized in this function > drivers/acpi/acpi_watchdog.c:105: error: 'res.name' may be used uninitialized in this function > > Newer compilers can presumably optimize the uninitialized access > away entirely and don't warn at all, but rely on the kzalloc() > to zero the structure first. This adds an explicit initialization > to force consistent behavior. > > Fixes: 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog") > Signed-off-by: Arnd Bergmann Acked-by: Mika Westerberg