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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAB01C83F3E for ; Sun, 3 Sep 2023 09:43:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236251AbjICJn7 (ORCPT ); Sun, 3 Sep 2023 05:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbjICJn6 (ORCPT ); Sun, 3 Sep 2023 05:43:58 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE9CCC7 for ; Sun, 3 Sep 2023 02:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693734235; x=1725270235; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nVvY2zgMHS1Nk0W2QWVzNbG/CIXehPZg1lY9zdv05zs=; b=T9Ldn42r86CS5Jo731n23VTGj9PcGr9VnjTQuXy+hXcu2vFjcTERlqhL r+HECZCqsR8w4FoxtfcnsCuBVgd21b1JDX5Obg0VB8THf7S99TR7q5qrx 3BpthwKDP+UEppTxjFeeU694sK31V74hsKOpPvaoR7IhOCG9YmHcFnYDw dprhqUO1lX2Y+obKlLPHDUAwmXuMp23BI3+y79Xj5G9V/YjKljx8aa3Q/ PGRj3mVPEFngOafByvMTudasLlYUROkWYyIQkFNnmCiTK8bUWeIhqHVyG wacLZ224x7SafVOCBfiZ1qKSd3k3M2CUx+hDkLHrzw9lXdpzVI53IgHpp Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10821"; a="380226617" X-IronPort-AV: E=Sophos;i="6.02,224,1688454000"; d="scan'208";a="380226617" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2023 02:43:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10821"; a="734003107" X-IronPort-AV: E=Sophos;i="6.02,224,1688454000"; d="scan'208";a="734003107" Received: from lkp-server01.sh.intel.com (HELO 5d8055a4f6aa) ([10.239.97.150]) by orsmga007.jf.intel.com with ESMTP; 03 Sep 2023 02:43:52 -0700 Received: from kbuild by 5d8055a4f6aa with local (Exim 4.96) (envelope-from ) id 1qcje1-00034N-1x; Sun, 03 Sep 2023 09:43:49 +0000 Date: Sun, 3 Sep 2023 17:43:45 +0800 From: kernel test robot To: Jinjie Ruan , brendan.higgins@linux.dev, davidgow@google.com, skhan@linuxfoundation.org, jk@codeconstruct.com.au, dlatypov@google.com, rmoar@google.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Cc: oe-kbuild-all@lists.linux.dev Subject: Re: [PATCH v2 2/4] kunit: Fix the wrong err path and add goto labels in kunit_filter_suites() Message-ID: <202309031733.usGHpnSR-lkp@intel.com> References: <20230903071028.1518913-3-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230903071028.1518913-3-ruanjinjie@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Hi Jinjie, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on next-20230831] [cannot apply to v6.5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jinjie-Ruan/kunit-Fix-wild-memory-access-bug-in-kunit_free_suite_set/20230903-151137 base: linus/master patch link: https://lore.kernel.org/r/20230903071028.1518913-3-ruanjinjie%40huawei.com patch subject: [PATCH v2 2/4] kunit: Fix the wrong err path and add goto labels in kunit_filter_suites() config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230903/202309031733.usGHpnSR-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230903/202309031733.usGHpnSR-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202309031733.usGHpnSR-lkp@intel.com/ All warnings (new ones prefixed by >>): lib/kunit/executor.c: In function 'kunit_filter_suites': >> lib/kunit/executor.c:227:1: warning: label 'free_copy' defined but not used [-Wunused-label] 227 | free_copy: | ^~~~~~~~~ >> lib/kunit/executor.c:221:1: warning: label 'free_parsed_glob' defined but not used [-Wunused-label] 221 | free_parsed_glob: | ^~~~~~~~~~~~~~~~ vim +/free_copy +227 lib/kunit/executor.c 132 133 struct kunit_suite_set 134 kunit_filter_suites(const struct kunit_suite_set *suite_set, 135 const char *filter_glob, 136 char *filters, 137 char *filter_action, 138 int *err) 139 { 140 int i, j, k; 141 int filter_count = 0; 142 struct kunit_suite **copy, **copy_start, *filtered_suite, *new_filtered_suite; 143 struct kunit_suite_set filtered = {NULL, NULL}; 144 struct kunit_glob_filter parsed_glob; 145 struct kunit_attr_filter *parsed_filters = NULL; 146 147 const size_t max = suite_set->end - suite_set->start; 148 149 copy = kmalloc_array(max, sizeof(*filtered.start), GFP_KERNEL); 150 if (!copy) { /* won't be able to run anything, return an empty set */ 151 return filtered; 152 } 153 copy_start = copy; 154 155 if (filter_glob) 156 kunit_parse_glob_filter(&parsed_glob, filter_glob); 157 158 /* Parse attribute filters */ 159 if (filters) { 160 filter_count = kunit_get_filter_count(filters); 161 parsed_filters = kcalloc(filter_count, sizeof(*parsed_filters), GFP_KERNEL); 162 if (!parsed_filters) { 163 kfree(copy); 164 return filtered; 165 } 166 for (j = 0; j < filter_count; j++) 167 parsed_filters[j] = kunit_next_attr_filter(&filters, err); 168 if (*err) 169 goto free_parsed_filters; 170 } 171 172 for (i = 0; &suite_set->start[i] != suite_set->end; i++) { 173 filtered_suite = suite_set->start[i]; 174 if (filter_glob) { 175 if (!glob_match(parsed_glob.suite_glob, filtered_suite->name)) 176 continue; 177 filtered_suite = kunit_filter_glob_tests(filtered_suite, 178 parsed_glob.test_glob); 179 if (IS_ERR(filtered_suite)) { 180 *err = PTR_ERR(filtered_suite); 181 goto free_parsed_filters; 182 } 183 } 184 if (filter_count > 0 && parsed_filters != NULL) { 185 for (k = 0; k < filter_count; k++) { 186 new_filtered_suite = kunit_filter_attr_tests(filtered_suite, 187 parsed_filters[k], filter_action, err); 188 189 /* Free previous copy of suite */ 190 if (k > 0 || filter_glob) { 191 kfree(filtered_suite->test_cases); 192 kfree(filtered_suite); 193 } 194 195 filtered_suite = new_filtered_suite; 196 197 if (*err) 198 goto free_parsed_filters; 199 200 if (IS_ERR(filtered_suite)) { 201 *err = PTR_ERR(filtered_suite); 202 goto free_parsed_filters; 203 } 204 if (!filtered_suite) 205 break; 206 } 207 } 208 209 if (!filtered_suite) 210 continue; 211 212 *copy++ = filtered_suite; 213 } 214 filtered.start = copy_start; 215 filtered.end = copy; 216 217 free_parsed_filters: 218 if (filter_count) 219 kfree(parsed_filters); 220 > 221 free_parsed_glob: 222 if (filter_glob) { 223 kfree(parsed_glob.suite_glob); 224 kfree(parsed_glob.test_glob); 225 } 226 > 227 free_copy: 228 if (*err) 229 kfree(copy); 230 231 return filtered; 232 } 233 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki