From patchwork Fri Sep 15 19:55:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 112756 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp998478qgf; Fri, 15 Sep 2017 12:56:23 -0700 (PDT) X-Google-Smtp-Source: ADKCNb46xhMj2UZLiq6E9r88tXWizmANSeLJSTLsQcj4GgPtYX7wY2lbKW+to06vqJUImSrjPoj1 X-Received: by 10.99.56.29 with SMTP id f29mr25259209pga.328.1505505383260; Fri, 15 Sep 2017 12:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505505383; cv=none; d=google.com; s=arc-20160816; b=k4Sd1qWLbsrWRJhfNxtkxt5iPprIgdb2Lah6vcJQV2mAFHSdL9QvCIai5a//8CfG7P /0LJN/n9Cm1Be5eeKb8Em3xq4Ky9xVerRugdZR1m6ny7iuu616rF6jxblx3sYP8MPg+d Kb82eEKc4kY6uTHqssUPMnG+FWxcxU5D2WjqZ5y2tnKrGavvw6Oe9gptxELEfra4IyQN 73Ozf/p2FQcbTIEiJKL3ffQbgB6QgCUuLqtJre1LFGShqivzzdwbX8vA1drqM//cR7sN kVX24O05sKsO14dnPZFlTAOOXd5CyvYcqVQbK5fQft5Ybpo4ofk6dA15gmhv106J0uEV GEWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=l5igDNKTKq/WnkAhnVASvCxYoS50WZyj6nSW7C/wEHo=; b=Xi4nceMVf14MWMn3jhJ7Iwwr5gp45dZTQhxj/WYeVBb+HQnAp9JtY1aYVy9t05+d64 qm5IAG/OAy+x3Yh5tBD/dUzm58AK6iWnrPg2v37wqSrCEsjMwiQI+Pm6mR6OYtjdGEnL kw1UlFAnohgeLq6O53o0ASj3IUG3tcUs7HsF3o762Weru2DlU0Y5Pw4OKtevuyDCQ9WY dg1nGpxCxPeTjJ8TTvoUeHVMLw0DMXErHbp4A9LVnxkTy6DXg8GUuSFkIOo4jPmuqk7m 7eGp7bJtmlqM+eq1YXSaMdRaziPt49rMvhFulrH7lx9D+F8Vtj2eiQPtxnOrXaYbbluH v3lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 j6si1189335pll.26.2017.09.15.12.56.22; Fri, 15 Sep 2017 12:56:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbdIOT4V (ORCPT + 7 others); Fri, 15 Sep 2017 15:56:21 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50613 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751825AbdIOT4V (ORCPT ); Fri, 15 Sep 2017 15:56:21 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0M3rTW-1dc6eB2AqI-00rZSB; Fri, 15 Sep 2017 21:55:29 +0200 From: Arnd Bergmann To: "Rafael J. Wysocki" , Len Brown Cc: Arnd Bergmann , Mika Westerberg , Ryan Kennedy , Guenter Roeck , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] acpi: watchdog: properly initialize resources Date: Fri, 15 Sep 2017 21:55:18 +0200 Message-Id: <20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0r mbTa5d64HPcKkrJznmMzl0g+OZg+eiPnCpWC6g== Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- drivers/acpi/acpi_watchdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Guenter Roeck Acked-by: Mika Westerberg diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c index bf22c29d2517..11b113f8e367 100644 --- a/drivers/acpi/acpi_watchdog.c +++ b/drivers/acpi/acpi_watchdog.c @@ -66,7 +66,7 @@ void __init acpi_watchdog_init(void) for (i = 0; i < wdat->entries; i++) { const struct acpi_generic_address *gas; struct resource_entry *rentry; - struct resource res; + struct resource res = {}; bool found; gas = &entries[i].register_region;