Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5639967rwb; Mon, 5 Dec 2022 01:53:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf714myHy0OIi3mdHxaJvvez49ggUgsZG2pa4drBH6w+d+dYkEot/gAA9GGHkuGr6O3Gyqye X-Received: by 2002:a17:90a:d510:b0:219:2f88:ae3a with SMTP id t16-20020a17090ad51000b002192f88ae3amr14238pju.106.1670234007115; Mon, 05 Dec 2022 01:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670234007; cv=none; d=google.com; s=arc-20160816; b=r2OMyO112KnQVbUI29fgAMkj0uOprSt0qVwOleF84otFZo/SMxIR0MomnQYNj2EHay wnOF2jQd/WQdW01v1KJFLHJmif7gm+7/jdV5kva7SKK4foaoeZ8R2EtadG/RfxhtquK9 orkbgG01Z3imHRu2rAyOmqAK1Bl2LmLNaLUt3eBb5ndy4xlin/bSCbUSZdQggrLQ5wv2 1oPnFKvBVOD1ALqDabkEvKHdyHeRR6bjQZdAkP4OzmK8kVzS6k5HPvvuoYR+2yXUb6gl dnzNn5I7uph+JJLeCFDkrM6x0WP8VCfrPcijo6pncqD/912W8I8tuVNg+TyT/Z8Qhzdh 8JSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature; bh=SeNUztr539lKtOjkDPJXHLKWIhr1Ln9xNj0gAvIEWDo=; b=rcsukJCo1Dkg2z4Z1CLs+jmAzTU/mwvikAvcVs1gp8cuyoEvv7/zHjcMM+gcfjY4aV gdI1kMujfcS6Uvfg6CS9LVbVrZKsQ/2PspEQWXGj8+tzg+RRWKaDg9HogV8cgiPFUm8n Vs7+krUPYz3BosIT7iIAgHXm0TEaTaoB668lMsGCiayRp28yeI0LMVmNkeFFtDbll2GL KcxUaY8pSA+rSkeCl2yaQ2S150Jy17AknuCM60o0gkrndu5pxtjJd+QYVyUiMKhrQ1iC q6Q68xN6h0/RZercpdbwM71AI/DfXoevqG9+ZEg6788Eoix9/40l+NkVTIjFmiQKZORI Lg/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=eHZzTkjL; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q34-20020a63f962000000b00473d2108701si13045504pgk.198.2022.12.05.01.53.16; Mon, 05 Dec 2022 01:53:27 -0800 (PST) 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=@walle.cc header.s=mail2022082101 header.b=eHZzTkjL; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231849AbiLEIps (ORCPT + 82 others); Mon, 5 Dec 2022 03:45:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232338AbiLEIpP (ORCPT ); Mon, 5 Dec 2022 03:45:15 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3CED17A80; Mon, 5 Dec 2022 00:45:09 -0800 (PST) Received: from 3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 278291D08; Mon, 5 Dec 2022 09:45:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1670229907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SeNUztr539lKtOjkDPJXHLKWIhr1Ln9xNj0gAvIEWDo=; b=eHZzTkjLqogN3gV+suNRQjDiUzrbDtAegwFaGE9CWtjjDwHwqA6R0T/yPkZuyydQsyQmOS A0qoInVVcZjZcYD1VZ0g70g5BBpzn6bltAiuiJxdpf1aYZn1AQbZWSe3qjPyhpeQ4xkjS/ R8Ubc+u0vEqS3IFdUI7aW54GIDZVLJq6M9Gr9/u6DjJ09F+yjX+I3WxEXSjVybJubCMPGE QpgpAxE2vfKByyc94cIM+TdRjnok7NEwt73SzoQODdwgAsJeCugfKdCY2R/rv8KhB0z3Cb 56haCMLnp+xHRagVQPnOBvmgaMCPR5M8NZ09lNNoCgV6fVFv2CsHf4bOC4tX6A== MIME-Version: 1.0 Date: Mon, 05 Dec 2022 09:45:06 +0100 From: Michael Walle To: Dan Carpenter Cc: oe-kbuild@lists.linux.dev, Jonathan Corbet , Srinivas Kandagatla , Miquel Raynal , Rob Herring , Frank Rowand , Sascha Hauer , lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH v4 10/20] nvmem: core: use nvmem_add_one_cell() in nvmem_add_cells_from_of() In-Reply-To: <202212030011.DQpDmsBb-lkp@intel.com> References: <202212030011.DQpDmsBb-lkp@intel.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: michael@walle.cc Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 Am 2022-12-03 09:30, schrieb Dan Carpenter: > Hi Michael, > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: > https://github.com/intel-lab-lkp/linux/commits/Michael-Walle/nvmem-core-introduce-NVMEM-layouts/20221124-020554 > patch link: > https://lore.kernel.org/r/20221123180151.2160033-11-michael%40walle.cc > patch subject: [PATCH v4 10/20] nvmem: core: use nvmem_add_one_cell() > in nvmem_add_cells_from_of() > config: i386-randconfig-m021 > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot > | Reported-by: Dan Carpenter > > New smatch warnings: > drivers/nvmem/core.c:731 nvmem_add_cells_from_of() warn: possible > memory leak of 'cell' > > Old smatch warnings: > drivers/nvmem/core.c:735 nvmem_add_cells_from_of() warn: possible > memory leak of 'cell' > > vim +/cell +731 drivers/nvmem/core.c > > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 689 static int > nvmem_add_cells_from_of(struct nvmem_device *nvmem) > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 690 { > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 691 struct device > *dev = &nvmem->dev; > 7ae6478b304bc0 Srinivas Kandagatla 2021-10-13 692 struct > nvmem_cell_entry *cell; > 18f50dbcfd3676 Michael Walle 2022-11-23 693 struct device_node > *child; > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 694 const __be32 > *addr; > 18f50dbcfd3676 Michael Walle 2022-11-23 695 int len, ret; > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 696 > 18f50dbcfd3676 Michael Walle 2022-11-23 697 > for_each_child_of_node(dev->of_node, child) { > 18f50dbcfd3676 Michael Walle 2022-11-23 698 struct > nvmem_cell_info info = {0}; > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 699 > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 700 addr = > of_get_property(child, "reg", &len); > 0445efacec75b8 Ahmad Fatoum 2021-01-29 701 if (!addr) > 0445efacec75b8 Ahmad Fatoum 2021-01-29 702 continue; > 0445efacec75b8 Ahmad Fatoum 2021-01-29 703 if (len < 2 * > sizeof(u32)) { > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 704 dev_err(dev, > "nvmem: invalid reg on %pOF\n", child); > 63879e2964bcee Christophe JAILLET 2021-06-11 705 > of_node_put(child); > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 706 return -EINVAL; > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 707 } > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 708 > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 709 cell = > kzalloc(sizeof(*cell), GFP_KERNEL); > 63879e2964bcee Christophe JAILLET 2021-06-11 710 if (!cell) { > 63879e2964bcee Christophe JAILLET 2021-06-11 711 > of_node_put(child); > e888d445ac33a5 Bartosz Golaszewski 2018-09-21 712 return -ENOMEM; > 63879e2964bcee Christophe JAILLET 2021-06-11 713 } > > Seems like "cell" is not used any more so this just leaks. Damn, what a stupid bug from me. Thanks for catching this. -michael