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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F64FC4345F for ; Fri, 26 Apr 2024 02:28:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1EE4A6B008C; Thu, 25 Apr 2024 22:28:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 19E686B0092; Thu, 25 Apr 2024 22:28:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0651E6B0093; Thu, 25 Apr 2024 22:28:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DDB856B008C for ; Thu, 25 Apr 2024 22:28:58 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8BB81C0624 for ; Fri, 26 Apr 2024 02:28:58 +0000 (UTC) X-FDA: 82050100356.20.07161F0 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by imf03.hostedemail.com (Postfix) with ESMTP id 42C6C20014 for ; Fri, 26 Apr 2024 02:28:55 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=dcPHeSRG; spf=pass (imf03.hostedemail.com: domain of lkp@intel.com designates 198.175.65.20 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714098536; h=from:from:sender: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:in-reply-to: references:dkim-signature; bh=ioNnG4gB4XoiAbgMnZx8BPJUctRjvu0ve+VJi1P2a9I=; b=IPp/6uC01jx/yRfNFksSdGcyQkfIJ0vcUoU/xPLv0R9LD0mjm7bTGVmLchJkwi4TwAz9KQ b5rFoKbEPb1xYiis5xfqYvI+yt9Q4wHTD86/ObTeEnlNrdBdsslwuzE0+ghc9ylONiFXMe 3ABygQDIIglaFxX0NfY7mqpIfy4pvYg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=dcPHeSRG; spf=pass (imf03.hostedemail.com: domain of lkp@intel.com designates 198.175.65.20 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714098536; a=rsa-sha256; cv=none; b=Z1hE35t8yp8nqXwKKNxvbSV24lpH/0c7JA2F9tk9uNuM5Kj3UWm7MqLvTCmXsQbeICkfSW UMBR8V5UpgzDV4CGzutBLUDmASA/62mGSPwaj+mGRjJ7pZM0xN4Rqnofzrzt+zFW4UFMfy 6b9jZYKn+VlZcCuF/ztqADECM96Cf6c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714098536; x=1745634536; h=date:from:to:cc:subject:message-id:mime-version; bh=LZl27n06NKRILSusKBlQy3VJGqe2IeAoo9nGPcS7h3w=; b=dcPHeSRG6OZKYUBtfuaxALVYmaG+uCeUVDAsua4PygAIt7iUDbFux0s5 eXBwGRvdoglkeOc0mcX1hsfVrK3nqVUN5JDzxKKKF+EOv1uAYtZ2HYuRH eUo1Kl46bjnWDxIoDJ+9d4tfvuwj4l9XkJ8BYzSN/dNH5BIpGTH27331S PcTwPpVJge/Q/+npEcsk1He8Pc7OTcYKD6/IQ8/cH0oMsF885JwOkzRGZ jyimfGs1tZy7Z86U4doCVRPkTo1baTlCWW5El/2SEs5jvW7BA+MVZ0t3t g7lFISydP4DP7DMLKx1ZQI242KdDSbQ2Ag11P7K8igzSppTw6kL0Turaw Q==; X-CSE-ConnectionGUID: ScIxw8sfQxWX+Eu0Qn4bRg== X-CSE-MsgGUID: MRuaS4c1RP6gflvLShsilw== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="9658970" X-IronPort-AV: E=Sophos;i="6.07,231,1708416000"; d="scan'208";a="9658970" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 19:28:28 -0700 X-CSE-ConnectionGUID: L5yUacLnS66Kn47v9K+1Hw== X-CSE-MsgGUID: Buks9uPERr2/JSzrKbFVKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,231,1708416000"; d="scan'208";a="25276470" Received: from lkp-server01.sh.intel.com (HELO e434dd42e5a1) ([10.239.97.150]) by fmviesa009.fm.intel.com with ESMTP; 25 Apr 2024 19:28:27 -0700 Received: from kbuild by e434dd42e5a1 with local (Exim 4.96) (envelope-from ) id 1s0BK4-0003Ag-25; Fri, 26 Apr 2024 02:28:24 +0000 Date: Fri, 26 Apr 2024 10:27:38 +0800 From: kernel test robot To: Sourabh Jain Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Michael Ellerman Subject: [linux-next:master 7646/8170] arch/powerpc/kexec/crash.c:488:2-8: WARNING: NULL check before some freeing functions is not needed. Message-ID: <202404261048.skfV5DDB-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Stat-Signature: dt3tbd38p3awfa344oqktrayzp6m6dma X-Rspamd-Queue-Id: 42C6C20014 X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1714098535-935537 X-HE-Meta: U2FsdGVkX19pVroqltMHSZ1kCgtbCWbqEbLBoiKKNhh38jZ1JJ/56HuIdRLmY8/xPlKWO78GXzmsj0gK7JF3Cz7lXfa8t8uPcam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u8FG25lSF30zM48+Oe/qV4pv8YAdB3t/+xg0h7iSDOlpYnlOGfOipLTrToYhZcbrbLKl0JJ9Uy888FKI/uT94bDSTf0dj5X3osjMEIZ0tpp7MWjHMIvcNkanxQQXs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 5e4f84f18c4ee9b0ccdc19e39b7de41df21699dd commit: 849599b702ef8977fcd5b2f27c61ef773c42bb88 [7646/8170] powerpc/crash: add crash memory hotplug support config: powerpc-randconfig-r061-20240426 (https://download.01.org/0day-ci/archive/20240426/202404261048.skfV5DDB-lkp@intel.com/config) compiler: powerpc-linux-gcc (GCC) 13.2.0 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/202404261048.skfV5DDB-lkp@intel.com/ cocci warnings: (new ones prefixed by >>) >> arch/powerpc/kexec/crash.c:488:2-8: WARNING: NULL check before some freeing functions is not needed. vim +488 arch/powerpc/kexec/crash.c 418 419 /** 420 * update_crash_elfcorehdr() - Recreate the elfcorehdr and replace it with old 421 * elfcorehdr in the kexec segment array. 422 * @image: the active struct kimage 423 * @mn: struct memory_notify data handler 424 */ 425 static void update_crash_elfcorehdr(struct kimage *image, struct memory_notify *mn) 426 { 427 int ret; 428 struct crash_mem *cmem = NULL; 429 struct kexec_segment *ksegment; 430 void *ptr, *mem, *elfbuf = NULL; 431 unsigned long elfsz, memsz, base_addr, size; 432 433 ksegment = &image->segment[image->elfcorehdr_index]; 434 mem = (void *) ksegment->mem; 435 memsz = ksegment->memsz; 436 437 ret = get_crash_memory_ranges(&cmem); 438 if (ret) { 439 pr_err("Failed to get crash mem range\n"); 440 return; 441 } 442 443 /* 444 * The hot unplugged memory is part of crash memory ranges, 445 * remove it here. 446 */ 447 if (image->hp_action == KEXEC_CRASH_HP_REMOVE_MEMORY) { 448 base_addr = PFN_PHYS(mn->start_pfn); 449 size = mn->nr_pages * PAGE_SIZE; 450 ret = remove_mem_range(&cmem, base_addr, size); 451 if (ret) { 452 pr_err("Failed to remove hot-unplugged memory from crash memory ranges\n"); 453 goto out; 454 } 455 } 456 457 ret = crash_prepare_elf64_headers(cmem, false, &elfbuf, &elfsz); 458 if (ret) { 459 pr_err("Failed to prepare elf header\n"); 460 goto out; 461 } 462 463 /* 464 * It is unlikely that kernel hit this because elfcorehdr kexec 465 * segment (memsz) is built with addition space to accommodate growing 466 * number of crash memory ranges while loading the kdump kernel. It is 467 * Just to avoid any unforeseen case. 468 */ 469 if (elfsz > memsz) { 470 pr_err("Updated crash elfcorehdr elfsz %lu > memsz %lu", elfsz, memsz); 471 goto out; 472 } 473 474 ptr = __va(mem); 475 if (ptr) { 476 /* Temporarily invalidate the crash image while it is replaced */ 477 xchg(&kexec_crash_image, NULL); 478 479 /* Replace the old elfcorehdr with newly prepared elfcorehdr */ 480 memcpy((void *)ptr, elfbuf, elfsz); 481 482 /* The crash image is now valid once again */ 483 xchg(&kexec_crash_image, image); 484 } 485 out: 486 kvfree(cmem); 487 if (elfbuf) > 488 kvfree(elfbuf); 489 } 490 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki