Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1703097rwo; Wed, 2 Aug 2023 20:22:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlGza9MqloH2qU+kbAQy3JETjWa2dsj0vCy7xlRtROPdpoby2zv8nOIYG/Rf1Q+xCYhfQfiG X-Received: by 2002:a05:6512:754:b0:4f6:1b45:e8aa with SMTP id c20-20020a056512075400b004f61b45e8aamr4787525lfs.50.1691032931494; Wed, 02 Aug 2023 20:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691032931; cv=none; d=google.com; s=arc-20160816; b=slN9LIaInwEh/q82FSo+o5d7QuDdBtBcaHixu8Mcj40RH3oVZJappax9otgUE05gmo J9ChxtwBLJRetX2yv06J7xM3GtimYKyBb1nPRC8fhDdLkN1nU6AmhbL3oGOwwjNOTqOz OqEOQC6vq0qtpHi2cWb9e0fWfZk9irR9UxKsHZqzejJmNFnTwhJJRJeEgwRbNRvtdur/ 2ReoCMhqQ0nrOykZl/ZSirsFu+sKlfYo25SbSNOk5ftV8db7G50mNtKtrVbzX/rbm0XH b5Sh/JuKBXeOprTCF7O7Hh9XThWSJn8rKMh6q1IqVwSFfr1LmUuUjJvLwGEuxnumDopw NtFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc:to :content-language:subject:user-agent:mime-version:date:message-id; bh=0+vjH1VIy2F5VdvYEzjTr5N9Ms9ZFNEo6nj9HCZy2Xs=; fh=BeMUlQhj2kZo0MuVP0zEQ5+4Yq7kLSFlc9hr+t6ay0A=; b=EJio2diUbBHb8RbBdjLyFPYdo/NMvv6BsIN7kRckI1Q7s27JNwqdjLW5eXbQYf49xs w0lRC53rfFXDTlWAXpc23bF3i6abIl0z3Wf+MNdSXNRiRMDE1gHmyuESZ8ThP+Fc90HL VnEiy4uAJleRitRrNxD1z2c9VsFIayZuTwOtNMxAFJTjxSQKuInj8MtLvxmF1W7Lm2bV rqniElD3cm9LovxZjnoK/oTKOZENpKBxjT0rLKuom2Wf27T0SyJzEp8sPjKy3nOvyn1F aKH7j+9aY78hpobh2ht9Pdqvha1QphevS/uBRfYmsp2dZZdfEa2uMSB5tQ4FA/ssDEDd FVKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa7d502000000b00522c0ee05d9si6966702edq.241.2023.08.02.20.21.45; Wed, 02 Aug 2023 20:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbjHCDIq (ORCPT + 99 others); Wed, 2 Aug 2023 23:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231557AbjHCDIp (ORCPT ); Wed, 2 Aug 2023 23:08:45 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 175951BD9; Wed, 2 Aug 2023 20:08:43 -0700 (PDT) Received: from [172.30.11.106] (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 374596082CF9F; Thu, 3 Aug 2023 11:08:35 +0800 (CST) Message-ID: <414e987b-df9f-53c9-6455-4a2d10f7fcf5@nfschina.com> Date: Thu, 3 Aug 2023 11:08:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] fs: lockd: avoid possible wrong NULL parameter Content-Language: en-US To: Dan Carpenter Cc: chuck.lever@oracle.com, jlayton@kernel.org, neilb@suse.de, kolga@netapp.com, Dai.Ngo@oracle.com, tom@talpey.com, trond.myklebust@hammerspace.com, anna@kernel.org, nathan@kernel.org, ndesaulniers@google.com, trix@redhat.com, bfields@fieldses.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui In-Reply-To: <0bd584fd-74ac-4b08-ae03-12e329ab186e@kadam.mountain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,RDNS_NONE, SCC_BODY_URI_ONLY,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 2023/8/2 18:41, Dan Carpenter wrote: > There was a big fight about memcpy() in 2010. > > https://lwn.net/Articles/416821/ > > It's sort of related but also sort of different. My understanding is > that the glibc memcpy() says that memcpy() always does a dereference so > it can delete all the NULL checks which come after. The linux kernel > uses -fno-delete-null-pointer-checks to turn this behavior off. Really big fight! This article seems talk about  problem that using memcpy() to copy overlapping regions. I'm not sure glibc memcpy does the check about NULL, but glibc printf does this check. "And GNU libc checks strings passed to printf for a %s placeholder for NULL, when the C standard says this is not allowed."[1] [1] https://lwn.net/Articles/416821/ > > regards, > dan carpenter