Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp663347iog; Mon, 13 Jun 2022 10:07:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNW8UtJ56QiV0dtkFkpCnzpD1XF2l6tfToQRrNewe0ZnHdqGIhaskEcECYlA/vu7JZWDt7 X-Received: by 2002:a17:90b:4c06:b0:1e3:17fa:e387 with SMTP id na6-20020a17090b4c0600b001e317fae387mr16926544pjb.53.1655140069897; Mon, 13 Jun 2022 10:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655140069; cv=none; d=google.com; s=arc-20160816; b=mza6NAEQAkl2iY+PMG70UecG0An7rzP6cmiVninvnszhqRKIp8HdpbddB+asvg7YK7 1FmluAS9KBlCV/1mTnbUUXSNXJNAjpeK2DjaOMzUtVz2wrE1LDQFwUX3wkmVTZ1VO+RK cIInPR/zWIbq2UUJaQfLt7rBvhawhWoax0gwmVXoZFCDVSQbdf3+UPS2jf5Y2Iu04rJ9 Mge4dwUcUIDHQ4J7UkWjTUcDiNGjbKTQFkr0l9UO9RLEdJxjSPjS59qTE/Y+9DPb9u3T 0YKG+qQX5qCr9I30I65TX4TBoTzuEPq/vcQBEZuR3OFglRbQ3C4bRFzbVxz/P9DWw9Fo 8O1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QEQzN4vuz0ok0Vo1w27gX31H3OD8kD4YfbBWmk7h3jM=; b=Ad26S4P3ORme7hVsaeiah22OZTchtQXlndpwd4cmfQ8l2m0ibI89xneiKT5rrIVfJm S1Jj5AOsuURDM/Bn6XZAsbTZS9z5gmTZSUufLPyg4rqxv7VrqjnZ+qRE9Wryryh23ZLc rIOpAQ9NR24+Qr0DXZ5MHnMGtPg1tj1kFjWg/iO9pp/N3i19QSkQQO6L/KhpoPAi9pUT 95LzeneTMpLFusMvTn6SBT8vB5bFeETP82CYbjtti/Sko/+qbhCeD9/UFGtHD04qsG4P Ie2ylgOajBncuXKfv/+DtOZXQasLQrOS8Gqz4KQZQfkqSJZEFVmndFsufg0fb8lPDcDn K/lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V+rjMh7U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rt14-20020a17090b508e00b001df40d766e3si9327985pjb.144.2022.06.13.10.07.36; Mon, 13 Jun 2022 10:07:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V+rjMh7U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377529AbiFMNdN (ORCPT + 99 others); Mon, 13 Jun 2022 09:33:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377964AbiFMNam (ORCPT ); Mon, 13 Jun 2022 09:30:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8EC66EB27; Mon, 13 Jun 2022 04:25:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C63261221; Mon, 13 Jun 2022 11:25:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1C76C34114; Mon, 13 Jun 2022 11:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655119518; bh=NnYNH6IYy9RIKjB57M8bXB1He/zInldRkDkUMteEkPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+rjMh7U0fDKNYAP6H3rFmAOhFDqEc99DYNZ+Oz1SaKvhAAf6vB5On1kyz1c2Xd4s wmGFPOmA+T7kF/TR5OkVjCkTgNeE6Ys5D/Unu4E/5PbRziEk8iV8ciwb+l7tw0s5He eE4NwH2rN10pzwdKi1aawKnLh2mCyI4VEb+ln08M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.18 041/339] power: supply: core: Initialize struct to zero Date: Mon, 13 Jun 2022 12:07:46 +0200 Message-Id: <20220613094927.765614010@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094926.497929857@linuxfoundation.org> References: <20220613094926.497929857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit e56a4be2843c95c08cf8421dc1f8e880cafbaf91 ] As we rely on pointers in the battery info to be zero-initialized such as in the helper function power_supply_supports_vbat2ri() we certainly need to allocate the struct power_supply_battery_info with kzalloc() as well. Else this happens: Unable to handle kernel paging request at virtual address 00280000 (...) PC is at power_supply_vbat2ri+0x50/0x12c LR is at ab8500_fg_battery_resistance+0x34/0x108 Fixes: e9e7d165b4b0 ("power: supply: Support VBAT-to-Ri lookup tables") Signed-off-by: Linus Walleij Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/power_supply_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index d925cb137e12..fad5890c899e 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -616,7 +616,7 @@ int power_supply_get_battery_info(struct power_supply *psy, goto out_put_node; } - info = devm_kmalloc(&psy->dev, sizeof(*info), GFP_KERNEL); + info = devm_kzalloc(&psy->dev, sizeof(*info), GFP_KERNEL); if (!info) { err = -ENOMEM; goto out_put_node; -- 2.35.1