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 3BEFAC636D4 for ; Fri, 17 Feb 2023 11:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229566AbjBQLNh (ORCPT ); Fri, 17 Feb 2023 06:13:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbjBQLNf (ORCPT ); Fri, 17 Feb 2023 06:13:35 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A72453ED6; Fri, 17 Feb 2023 03:13:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676632382; x=1708168382; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+QB7bJBNf4B00FliCasmuX9iTJnGkOIN//OmJgFuQGE=; b=nvOpk67BGcxoG9VYHTJVqRQSqQNdsQHnIwZJUpkRRDPShVeeKTHenila SMtNa16fI9VV/Awv3/2WoNTFa8EI3s72eqmsq88LCavDnipuqGaB7ElDH vCy99FXQ757lObD4Ky1ydEX11h6oJip6Mn8d5BVvwsFsba6wCWZihPPI1 16WAZ9MTUSsweiFMdWZKIpEAfVdNUwQz2Hw61YX1gc7PhN7pCNbBXMSFU XHBmcQAyJTFaFXM87MirDrZiRgrf3B20aNQhQPVjeQtsn7HYw+x84U0O5 rvCcabk8xdK91fXOL5wCKMDyxquM7+HtxyRZTmrjICG7Qb5tdhEOxcy/9 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="333324013" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="333324013" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2023 03:11:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="700867270" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="700867270" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP; 17 Feb 2023 03:11:50 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pSyeZ-008AvD-0d; Fri, 17 Feb 2023 13:11:47 +0200 Date: Fri, 17 Feb 2023 13:11:46 +0200 From: Andy Shevchenko To: Yury Norov Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Barry Song , Ben Segall , Bruno Goncalves , Dietmar Eggemann , Gal Pressman , Greg Kroah-Hartman , Haniel Bristot de Oliveira , Heiko Carstens , Ingo Molnar , Jacob Keller , Jakub Kicinski , Jason Gunthorpe , Jesse Brandeburg , Jonathan Cameron , Juri Lelli , Kees Cook , Leon Romanovsky , Linus Torvalds , Mel Gorman , Peter Lafreniere , Peter Zijlstra , Rasmus Villemoes , Saeed Mahameed , Steven Rostedt , Tariq Toukan , Tariq Toukan , Tony Luck , Valentin Schneider , Vincent Guittot , linux-crypto@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH 3/9] sched: add sched_numa_find_nth_cpu() Message-ID: References: <20230121042436.2661843-1-yury.norov@gmail.com> <20230121042436.2661843-4-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 16, 2023 at 05:39:08PM -0800, Yury Norov wrote: > From: Yury Norov > Date: Thu, 16 Feb 2023 17:03:30 -0800 > Subject: [PATCH] sched/topology: fix KASAN warning in hop_cmp() > > Despite that prev_hop is used conditionally on curr_hop is not the curr --> cur > first hop, it's initialized unconditionally. > > Because initialization implies dereferencing, it might happen that > the code dereferences uninitialized memory, which has been spotted by > KASAN. Fix it by reorganizing hop_cmp() logic. Nice catch! I guess it deserves for a comment inside the code (IIRC I was puzzled of the logic behind and it was changed due to lack of this knowledge.) -- With Best Regards, Andy Shevchenko