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 44AC1CE79A9 for ; Wed, 20 Sep 2023 01:36:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2D7C6B00F3; Tue, 19 Sep 2023 21:36:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DDA06B00F4; Tue, 19 Sep 2023 21:36:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CC366B00F5; Tue, 19 Sep 2023 21:36:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7D7016B00F3 for ; Tue, 19 Sep 2023 21:36:50 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 473951A1248 for ; Wed, 20 Sep 2023 01:36:50 +0000 (UTC) X-FDA: 81255261780.21.DD0EE04 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 47526C0009 for ; Wed, 20 Sep 2023 01:36:48 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LbSCuBLa; spf=pass (imf22.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.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=1695173808; 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=baEu5FPyeTXJzYRHn3PcdTp5ENYXg7QNVbnUbXlgQOg=; b=seVhMzE88gXK9Rye7G6L+QANbHA2wfQEaNaiEPoUlHgp6JZaf3sWYPveAHsiO6k94Xm3Ob bQACcDN8Z+TtHBPqaLfLiS4RqukvQSCCy54k3dUe/n8GnPDJGZjm04iTvASfdeS5szFfzQ bIO7dirol4yld8MUJ30cHc8G5a/pths= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695173808; a=rsa-sha256; cv=none; b=DCOLwkSuC8mkKQiK5Hg8XQZuVy3MkEpyzhKOt8Vn6nKS5FkyFi6d9pWLr1PWN1fqhjEbDu OT28XbPZoUsy+TLOIlWpQcNF/Uq5SZ27raFFFUmSQVgtq8ha5f7tKk6biooaruQws9nRSE jd53XmJhjIS1qIb4JAwpD9WfWbgZCxs= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LbSCuBLa; spf=pass (imf22.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.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=1695173807; 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=baEu5FPyeTXJzYRHn3PcdTp5ENYXg7QNVbnUbXlgQOg=; b=LbSCuBLaGzFbaRZUGfE6vYzJ/VA3z2gzzD6R8pY4wVfuUrbkJ4nBGusuV9Q94o7r+J3kBE ogUcP25IlQFH5tHZ6/+dpgDyF0DkUOQeuBM8mjmRrJv/5zE2PBBRhm8c6RQYYCmyY27KZS XpmxQb1FOwW0uhyjvQmXJ3ZW1nbJxE4= 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-658-HVVPq3jcP_aQ9b8IppfD7A-1; Tue, 19 Sep 2023 21:36:46 -0400 X-MC-Unique: HVVPq3jcP_aQ9b8IppfD7A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 CBF67800969; Wed, 20 Sep 2023 01:36:45 +0000 (UTC) Received: from localhost (unknown [10.72.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06803492B05; Wed, 20 Sep 2023 01:36:44 +0000 (UTC) Date: Wed, 20 Sep 2023 09:36:41 +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> <20230919181621.382be43e97f51effb47ab412@linux-foundation.org> MIME-Version: 1.0 In-Reply-To: <20230919181621.382be43e97f51effb47ab412@linux-foundation.org> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Stat-Signature: 6obzw1m9dqq6ectw6iiypbqppid3a3xa X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 47526C0009 X-Rspam-User: X-HE-Tag: 1695173808-766179 X-HE-Meta: U2FsdGVkX185nZCnEZW4HjHtcT22EE18KurcxzxFuZuet2kAzl5wj6G2FpcWZojIuAsmzJ/Dj2OrmrpcGKpY1xrikKd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pDq2mr1Lq+VSLU9wkxEQwKTzL7FTFMoUDTOqQUE7O6BqfkZC/O+SxN5V9cvwLtKY8i6ZKwxb8ZYloV5I86uywsrqjyE3dIzBg= 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 06:16pm, Andrew Morton wrote: > On Wed, 20 Sep 2023 07:11:45 +0800 Baoquan He wrote: > > > > > > > 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(). > > How the heck did I miss that. > > > Add below check anyway to satisfy the W=1 compiling? > > I dunno, gcc is so wrong here I'm inclined to leave it as-is, because > surely this will get fixed in later gcc's. > > > --- 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"); > > If we were to do this, let's have a comment explaining why we're doing > it - otherwise helpful people will try to remove it again. I will post v4 patchset anyway to include another fixing in patch 6/9 since LKP spotted a real issue causing compiling warning. I can add this change with a comment to explain why the checking is needed here.