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 6DE37CE79A9 for ; Tue, 19 Sep 2023 23:11:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFCF46B00E7; Tue, 19 Sep 2023 19:11:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CAD1F6B00E8; Tue, 19 Sep 2023 19:11:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9BAA6B00E9; Tue, 19 Sep 2023 19:11:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AA6D86B00E7 for ; Tue, 19 Sep 2023 19:11:56 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 80EC4160F02 for ; Tue, 19 Sep 2023 23:11:56 +0000 (UTC) X-FDA: 81254896632.30.AC3F56C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 7B221100011 for ; Tue, 19 Sep 2023 23:11:54 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Fcl5wVFy; spf=pass (imf14.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695165114; 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:in-reply-to:references:references:dkim-signature; bh=GSpQEVz82hsWdCT2oLCL1sbssVlUunFYm/OwYRtnCJ0=; b=D8AbyWfKIg1eQ0YwwforBEJhqnS/RNoK6TuJWp7DvMXrnc2tKoUxeG6OtdfxAuytZypQ3L CtQH9pnhbBskw9sDUMRBMtdfk3ovB3FSOMp4pqARUC1w6ri7Si9AByK3+UXhbw5cp/tpZM Jp4+oYXEH1E2B/2ntMQLwNdCDvdRcaY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695165114; a=rsa-sha256; cv=none; b=TKW9YIs1+MzgnS2Z5CKKeuZPtQqLANF5CSSc7XhwIX+CIuUpSOUUU/e4CqT90lKD8XqqcR LIAmpY3KmGvJh1uQ823ch/QkQW2Z4le8Xe/z5WXX0hPNUCLkv/xGOpZTy9Vvv/pD/qxRuO XxD+Rw76vtE8C6/8IGs0GEy8l3tTL0A= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Fcl5wVFy; spf=pass (imf14.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695165113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GSpQEVz82hsWdCT2oLCL1sbssVlUunFYm/OwYRtnCJ0=; b=Fcl5wVFyDUyrJG2Ss6gMvlaU9o5+FUUYUBN2RRTMpLCAZDNHk3NfkP0DccsQ1hnvLS0Fjh F19lKcpg/54d9MJL0oIhf1NfBBkbFRZazUGBwq7/Q0VJui/KoHOXq0iMizduiTTyT0uU9H 8rxtSR0kouXKLmYpQLJUQOVnAioEzBI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-297-PQTOcgODPyyiI5jmW6999g-1; Tue, 19 Sep 2023 19:11:50 -0400 X-MC-Unique: PQTOcgODPyyiI5jmW6999g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 050A9811E7B; Tue, 19 Sep 2023 23:11:50 +0000 (UTC) Received: from localhost (unknown [10.72.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1203E20268CC; Tue, 19 Sep 2023 23:11:48 +0000 (UTC) Date: Wed, 20 Sep 2023 07:11:45 +0800 From: Baoquan He To: Andrew Morton Cc: kernel test robot , oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Zhen Lei Subject: Re: [linux-next:master 5741/5912] kernel/crash_core.c:214:13: warning: argument 2 null where non-null expected Message-ID: References: <202309191144.B0MToaPG-lkp@intel.com> <20230919094200.0f6495393a8eef3dc398e8ac@linux-foundation.org> MIME-Version: 1.0 In-Reply-To: <20230919094200.0f6495393a8eef3dc398e8ac@linux-foundation.org> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 7B221100011 X-Rspam-User: X-Stat-Signature: 8suw7ar5kpn4f9wnh98t8nhtmo9n5ohc X-Rspamd-Server: rspam03 X-HE-Tag: 1695165114-549290 X-HE-Meta: U2FsdGVkX1+T7BnO/GwV/MCY739tS4qNUXJ9ATCeD4Tg2o3bDM4PPUvOmMZL4Xrx9pl5h7IIimxEnqAmzwBnof7LLq3F+SI8IOTEHma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VVr7pYmgf0Fq3HGLyV3+Wz/BhzsJ6Q+iKNK9XgQQq4VeFSnuszLuVNMKbnmFroAkJ+Z8Cnb2EDQUeQOhwtBI9+UL0nxWjGJVXPz6Lib418VqjKWDSNfnnhGX2LbM+n07QF3eUYozGx4QSCnTkM710eN6NsZIqcULEp+HQLzw+2a/Om3xUYv65DAUelYmHTMB8zm 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: On 09/19/23 at 09:42am, Andrew Morton wrote: > On Tue, 19 Sep 2023 12:02:17 +0800 kernel test robot wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > head: 7fc7222d9680366edeecc219c21ca96310bdbc10 > > commit: 5c322f6aad10f0920f842a4ccf82e9b9f351c0a5 [5741/5912] crash_core.c: remove unneeded functions > > config: s390-buildonly-randconfig-r006-20220512 (https://download.01.org/0day-ci/archive/20230919/202309191144.B0MToaPG-lkp@intel.com/config) > > compiler: s390-linux-gcc (GCC) 11.3.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230919/202309191144.B0MToaPG-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/202309191144.B0MToaPG-lkp@intel.com/ > > > > All warnings (new ones prefixed by >>): > > > > In file included from arch/s390/include/asm/atomic.h:12, > > from include/linux/atomic.h:7, > > from include/linux/mm_types_task.h:13, > > from include/linux/mm_types.h:5, > > from include/linux/buildid.h:5, > > from kernel/crash_core.c:7: > > kernel/crash_core.c: In function 'parse_crashkernel_suffix.constprop': > > >> kernel/crash_core.c:214:13: warning: argument 2 null where non-null expected [-Wnonnull] > > 214 | if (strncmp(cur, suffix, strlen(suffix))) { > > include/linux/compiler.h:68:10: note: in definition of macro '__trace_if_value' > > 68 | (cond) ? \ > > | ^~~~ > > include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var' > > 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) > > | ^~~~~~~~~~~~~~ > > Looks legit? parse_crashkernel() does > > ret = __parse_crashkernel(cmdline, system_ram, crash_size, > crash_base, NULL); > > and that suffix==NULL gets passed through to the strncmp()? Yeah, this looks like a false positive report. I reproduced this, below change can mute the warning. However, the null pointer checking has been done in __parse_crashkernel() when calls parse_crashkernel_suffix(). Add below check anyway to satisfy the W=1 compiling? diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 1a77d466eaed..b53270ac3715 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -204,6 +204,9 @@ static int __init parse_crashkernel_suffix(char *cmdline, { char *cur = cmdline; + if(!suffix) + return -EINVAL; + *crash_size = memparse(cmdline, &cur); if (cmdline == cur) { pr_warn("crashkernel: memory value expected\n");