Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3192054rwb; Mon, 16 Jan 2023 05:05:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMiaj3MuloKV87i7RjV8238aFA/KTj/DQyvr+dzQ94G9BlEsJt7QO72+NB5oMyFNiOck8A X-Received: by 2002:a17:907:8c08:b0:7c1:65d1:c4ca with SMTP id ta8-20020a1709078c0800b007c165d1c4camr63401685ejc.33.1673874340639; Mon, 16 Jan 2023 05:05:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874340; cv=none; d=google.com; s=arc-20160816; b=kEf7dkqUstmjrcPeOSZ08IHE0BBg2ZiatH4HAwYW5aewfTNUCdl4vFf492UFRFDpFf pFKnfbRFg9XumlPADXz6L5fR7HnPQIStg+k5Jmn/whGftZP7RZY+eQWrRIVklRksBfIA M8bERDarEdYDgCR1lcdL0QO79M8tCQR7U/koGb8JlyT0crNftp7N/p6i55V9Cga6CbPa ZYF8y6qHNyvAvTfYtl4UwDYDxNnm6739MC5GMX4YDZ6QnJaH9aDEi9xK7tL41Nbp2sYv Gp6z2tn2OBeXEMvEQfxEiMZ7RhB6DMuCNtf9Uk2Oag0FVWZzvgaZeDzqFQ42eQ9JqrsE wUaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6jhXVeZj3sO/tuUlaQsdeBNyp/PhhJvgN96rYmKb5i0=; b=s5WIUCAmChq29ffG0Da8yB1BI9IbMKqkyi5R9uURapuOYXNmjDcihzKgnVMCvpniaZ yBN/Ri7rl44DLqZME/s6aJOwuNssu83Fx4j8CBZ+kcQb2zbfof1bEEzlLOCqf26Pqo9b 5DziIhxzT2FLYHx+k5MI2AGwwmQIFr135d0ccPb+2j+TNE8WNMXCmHv3Hf1AFoJQNik5 U0KXPvHsLPbOC5AYJDuDvKnj7y3Li88PN4LO00GJLjpZd7wShz41jGuDDChf6Fi47YV/ 7EsedIhS1PBDS8t9iYqdoh9EfUxf2kk9KrI8zObGYHtqunb7gpaxmBSnuJC7CWuCyndh h46A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pIRuxEOO; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht14-20020a170907608e00b0078d484e0e7esi30739888ejc.488.2023.01.16.05.05.27; Mon, 16 Jan 2023 05:05:40 -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=@linaro.org header.s=google header.b=pIRuxEOO; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjAPMcZ (ORCPT + 51 others); Mon, 16 Jan 2023 07:32:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjAPMcW (ORCPT ); Mon, 16 Jan 2023 07:32:22 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5738D1DB88 for ; Mon, 16 Jan 2023 04:32:21 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id v23so25289377plo.1 for ; Mon, 16 Jan 2023 04:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6jhXVeZj3sO/tuUlaQsdeBNyp/PhhJvgN96rYmKb5i0=; b=pIRuxEOOjHvC13Fw5vC7vy9ty9Uk3lJKccR4rAlq3J68yWTuxFmYr6mjleM12U1os9 +ea2Buac1sqiNemABGgtvpxECZIpTZ5cW8fkU+Ug3x8tzTlj/qpfBlf0db3q2fIF4/zJ WX0wrCYbzSwrjmrsqWwakJGddd/DXEl90WA32FxtsAIhzz7278wGV7zThYSONSj3IUez rj7dQHn68WFKgheGfU5Al3BZxEjzV5GHE7wlaSOJUcifpP/ThlKPGnlgWZZI8xWo3ucl pLKOBMMPdryiKA29KktG0eOfVN5vh1qLO96rvhazTliD5J6G1Q9Q9gBtpW5vo5qxFGnz PRUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6jhXVeZj3sO/tuUlaQsdeBNyp/PhhJvgN96rYmKb5i0=; b=zsva5GaFOOlpPEmVWVjI/CSRXpuBRYdqH5PPt4EEPHaSd0VfYvrLWpF2jUiS3lFL7y fc/WVV0m53tQKwZInNFW6//xxFhADB6HTiOkqbPN1XeHMBNF3+gppUV4mDCJAOFUgzDI SjTZu/j3ks3efkeJLn1hytfHSgFE1M7IBfCwvMjkGTzhefpLGftS+e28HQOZUMihf3y9 Rfo4TQ8oZV9KuONYAPbAr9LCD1h6UivJGthI4klYh/mlUe2XBkXgqMPo24Q1NXe4sDgf Zn9MVDVnCh/jpDqoJMLdKaKKXzx24rdw6ctfaRoZDpJEXVeToCVA+H73zh8KUdiLgN30 vKxg== X-Gm-Message-State: AFqh2kppyq4CsdcJItl60cJarGKdNpWn44iQ11E/BmswPAHbtTGAna/u Y+H4EBDVYbm2dxt+sZfXXD8mKjjAwgVDDrzj4uIiEA== X-Received: by 2002:a17:903:2484:b0:194:706a:ad18 with SMTP id p4-20020a170903248400b00194706aad18mr735042plw.18.1673872340790; Mon, 16 Jan 2023 04:32:20 -0800 (PST) MIME-Version: 1.0 References: <20221219234638.3661-4-mike.leach@linaro.org> <202212240621.sgsPYIdK-lkp@intel.com> In-Reply-To: <202212240621.sgsPYIdK-lkp@intel.com> From: Mike Leach Date: Mon, 16 Jan 2023 12:32:09 +0000 Message-ID: Subject: Re: [PATCH v5 3/6] coresight: configfs: Add in binary attributes to load files To: Dan Carpenter Cc: oe-kbuild@lists.linux.dev, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, lkp@intel.com, oe-kbuild-all@lists.linux.dev, mathieu.poirier@linaro.org, suzuki.poulose@arm.com, acme@kernel.org, james.clark@arm.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi, Thanks for this - I'll fix in next set Mike On Sat, 24 Dec 2022 at 07:16, Dan Carpenter wrote: > > Hi Mike, > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Mike-Leach/coresight-syscfg-Extend-configfs-for-config-load/20221220-074850 > base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next > patch link: https://lore.kernel.org/r/20221219234638.3661-4-mike.leach%40linaro.org > patch subject: [PATCH v5 3/6] coresight: configfs: Add in binary attributes to load files > config: arm-randconfig-m041-20221218 > compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0 > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot > | Reported-by: Dan Carpenter > > smatch warnings: > drivers/hwtracing/coresight/coresight-syscfg-configfs.c:595 cscfg_cfg_load_write() warn: possible memory leak of 'load_descs' > > vim +/load_descs +595 drivers/hwtracing/coresight/coresight-syscfg-configfs.c > > 97b8fd654556b1 Mike Leach 2022-12-19 543 static ssize_t cscfg_cfg_load_write(struct config_item *item, const void *buffer, size_t size) > 97b8fd654556b1 Mike Leach 2022-12-19 544 { > 97b8fd654556b1 Mike Leach 2022-12-19 545 struct cscfg_fs_load_descs *load_descs = 0; > 97b8fd654556b1 Mike Leach 2022-12-19 546 struct cscfg_load_owner_info *owner_info = 0; > 97b8fd654556b1 Mike Leach 2022-12-19 547 int err = 0; > 97b8fd654556b1 Mike Leach 2022-12-19 548 > 97b8fd654556b1 Mike Leach 2022-12-19 549 /* ensure we cannot simultaneously load and unload */ > 97b8fd654556b1 Mike Leach 2022-12-19 550 if (!mutex_trylock(&cfs_mutex)) > 97b8fd654556b1 Mike Leach 2022-12-19 551 return -EBUSY; > 97b8fd654556b1 Mike Leach 2022-12-19 552 > 97b8fd654556b1 Mike Leach 2022-12-19 553 /* check configfs load / unload ops are permitted */ > 97b8fd654556b1 Mike Leach 2022-12-19 554 if (!cscfg_fs_load_enabled || unload_owner_info) { > 97b8fd654556b1 Mike Leach 2022-12-19 555 err = -EBUSY; > 97b8fd654556b1 Mike Leach 2022-12-19 556 goto exit_unlock; > 97b8fd654556b1 Mike Leach 2022-12-19 557 } > 97b8fd654556b1 Mike Leach 2022-12-19 558 > 97b8fd654556b1 Mike Leach 2022-12-19 559 if (size > CSCFG_FILE_MAXSIZE) { > 97b8fd654556b1 Mike Leach 2022-12-19 560 pr_err("cscfg: Load error - Input file too large.\n"); > 97b8fd654556b1 Mike Leach 2022-12-19 561 err = -EINVAL; > 97b8fd654556b1 Mike Leach 2022-12-19 562 goto exit_unlock; > 97b8fd654556b1 Mike Leach 2022-12-19 563 } > 97b8fd654556b1 Mike Leach 2022-12-19 564 > 97b8fd654556b1 Mike Leach 2022-12-19 565 load_descs = kzalloc(sizeof(struct cscfg_fs_load_descs), GFP_KERNEL); > 97b8fd654556b1 Mike Leach 2022-12-19 566 owner_info = kzalloc(sizeof(struct cscfg_load_owner_info), GFP_KERNEL); > 97b8fd654556b1 Mike Leach 2022-12-19 567 if (!load_descs || !owner_info) { > 97b8fd654556b1 Mike Leach 2022-12-19 568 err = -ENOMEM; > 97b8fd654556b1 Mike Leach 2022-12-19 569 goto exit_memfree; > > This exit leaks (will never happen in real life though). > > 97b8fd654556b1 Mike Leach 2022-12-19 570 } > 97b8fd654556b1 Mike Leach 2022-12-19 571 > 97b8fd654556b1 Mike Leach 2022-12-19 572 owner_info->owner_handle = load_descs; > 97b8fd654556b1 Mike Leach 2022-12-19 573 owner_info->type = CSCFG_OWNER_CONFIGFS; > 97b8fd654556b1 Mike Leach 2022-12-19 574 > 97b8fd654556b1 Mike Leach 2022-12-19 575 err = cscfg_file_read_buffer(buffer, size, load_descs); > 97b8fd654556b1 Mike Leach 2022-12-19 576 if (err) { > 97b8fd654556b1 Mike Leach 2022-12-19 577 pr_err("cscfg: Load error - Failed to read input file.\n"); > 97b8fd654556b1 Mike Leach 2022-12-19 578 goto exit_memfree; > 97b8fd654556b1 Mike Leach 2022-12-19 579 } > 97b8fd654556b1 Mike Leach 2022-12-19 580 > 97b8fd654556b1 Mike Leach 2022-12-19 581 err = cscfg_load_config_sets(load_descs->config_descs, load_descs->feat_descs, owner_info); > 97b8fd654556b1 Mike Leach 2022-12-19 582 if (err) { > 97b8fd654556b1 Mike Leach 2022-12-19 583 pr_err("cscfg: Load error - Failed to load configuaration file.\n"); > 97b8fd654556b1 Mike Leach 2022-12-19 584 goto exit_memfree; > 97b8fd654556b1 Mike Leach 2022-12-19 585 } > 97b8fd654556b1 Mike Leach 2022-12-19 586 > 97b8fd654556b1 Mike Leach 2022-12-19 587 mutex_unlock(&cfs_mutex); > 97b8fd654556b1 Mike Leach 2022-12-19 588 return size; > 97b8fd654556b1 Mike Leach 2022-12-19 589 > 97b8fd654556b1 Mike Leach 2022-12-19 590 exit_memfree: > 97b8fd654556b1 Mike Leach 2022-12-19 591 cscfg_configfs_free_owner_info(owner_info); > 97b8fd654556b1 Mike Leach 2022-12-19 592 > 97b8fd654556b1 Mike Leach 2022-12-19 593 exit_unlock: > 97b8fd654556b1 Mike Leach 2022-12-19 594 mutex_unlock(&cfs_mutex); > 97b8fd654556b1 Mike Leach 2022-12-19 @595 return err; > 97b8fd654556b1 Mike Leach 2022-12-19 596 } > > -- > 0-DAY CI Kernel Test Service > https://01.org/lkp > -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK