From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 285D3C677F1 for ; Mon, 16 Jan 2023 12:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=49k73sY6MlI1PUB+HlrnN6J9iNhXGSbWgHSvk0px6rY=; b=3+UWEa6RE4WgC4 8Veov6kt4VMPzlxECx3n4yVEvP6NZFxjmBhzG5SvsMR+rYY4I4wghSCCJ1hIvbBunzLY++jir1QV5 8uR4Mlb241Ts5GHa9iYX0qZXWSgiCLZIoIlqE7iDLCVzHqK9Gzhs2HzbtzTpBwuO8qj4xL9jF/Tvw WbWvElkV8KvPAtB7Jl4JfxDMAX3IAg+uFbhGecmhQsqUSsx9Lkx13DVFvtBS4zxmLjLFL53mUEwAq DclrmJZBlf+j6B/84L5ansxDRGx5FpBedB4NidI7v1d69mqD15al/MOp8ZrKsRayk51xZztfRzhZ3 ra6pPXqvWUu9smEpAYyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHOf3-00A6Ke-Lm; Mon, 16 Jan 2023 12:32:25 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHOf0-00A6Jn-9s for linux-arm-kernel@lists.infradead.org; Mon, 16 Jan 2023 12:32:24 +0000 Received: by mail-pl1-x636.google.com with SMTP id k12so8109431plk.0 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=TGRwA8kU6SQJ7xWfH5mfkSbsxAx5AIdF9efwSYwVv5WLAX8NU3tW+3iZ2rnBiYPiex MglD2CxWPYlXOrorMQtIIvP7wAW7rfIX4w9hop/RXwt4ZXVWjFRQh00LIzyf7QvsohKh LWsdewFtUO6vOnH5UuAwVRQxZv8WJcIpkifC67sw6QU5+zmAKvIVOe9ba6hg9xy9SydK Mhe1t2p167QtSFI6mlxEu3GoJqdNhQm8nTNCKMv0B+XSziDZ63w3EledKtOwJk8rB4zy 3lG9GOJFDMsDuw3PM54F6PRqtsIP393ge1EyLXvoiULslShOUpl66U59yw35SrdPaWl3 dvQw== X-Gm-Message-State: AFqh2ko6VQL55dY9I1MWyOOm3si+yVTlbrnpO1EoxQvXBJxIxGN5QCJ7 thrSMKjMeVYuBZnFBRvjk+ncMBikY5lJ6PTV87NbEQ== X-Google-Smtp-Source: AMrXdXu3o4PpTxE/H1KZemRNBlTBp4R7zzW6f9SXdERFAFvHV2e8V77Yo57ybKszjl9GCVLJvPSU529Hdi9tujPrdE0= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230116_043222_396256_0293DDF8 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel