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 X-Spam-Level: X-Spam-Status: No, score=0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1CBBC4707F for ; Thu, 27 May 2021 15:15:21 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7446461358 for ; Thu, 27 May 2021 15:15:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7446461358 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1lmHil-0007GO-6b; Thu, 27 May 2021 11:14:51 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from <42.hyeyoo@gmail.com>) id 1lmHij-0007GG-P7 for kernelnewbies@kernelnewbies.org; Thu, 27 May 2021 11:14:49 -0400 Received: by mail-pg1-x52d.google.com with SMTP id q15so142694pgg.12 for ; Thu, 27 May 2021 08:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition; bh=t8Hd2pmWQPB3I7dAn5dBcNfWdnh60fkp4xZ6Mf75L1Q=; b=On48TtUlqfk5V8fc1U1bTonUs3RiZPtxlznQGCb9AkZ/7zlqMjS7/vaFc/jzT8e2NU KTAI0TcVFGWDIx/r6/5zlgjnAPsZW343fwWKsnyWODT06rBhTLas9G1mD/w7e3shsAWZ FXf5OGsvPmzLNd/Xn5jfr41Tw5LAk1+ZPC4SiKQhx7cbjK4o7TdDV6BQ4u1a5RVNybGf vn7+L8XbZhaut6Cugi+MpEOr6I5yZLZ8afmzRoV8j7sb6zE7cdqk63uSE1Jq7Xm9+yYY Cxf+xvH0vEhVj+7eUQjYBk5JpVpswC4/M7A6l1z5BxxX+JemrNQFE4AvoQO3dipzAs+k zC6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=t8Hd2pmWQPB3I7dAn5dBcNfWdnh60fkp4xZ6Mf75L1Q=; b=mqZkAEC6HpCckRsPoxoTZ18/sjofFF48uRzSJCs0yvKc0DRmfVEc1BHUz2IEKY7CoH 0YJpaG6TrD0z7dj/uXrOlEwZUvHU/8pUo+/hWC6OW73wLcuy5YKhxkI+gTF4qoMvaws2 7cTNFEGjMfQZDlOETZR6/5Cct84N/OId3IjLkr2IhzaX7wu8OHEKppYFCTLPksmhZD2h NSo76fESds784CVM8MVVH8cVl+Bbs9I1wtGM3tauXPFTGHRyc/ybaxGxy4G6oBXaix3u ngzoxbWzHPBwhMd39txNXHIqlRjjuD8wibmxoubmlw+EVXR/WB1i1RLyGMz7IW1lFHVG a7gw== X-Gm-Message-State: AOAM530VQDS4Oh6uv1JXwpTPtY56FVUB89LVT/esdrutxXHyXGTZMUtg MOUnwsDDr94QAwXhsounDfU8hL7wCnuHSQ== X-Google-Smtp-Source: ABdhPJzb+vP6ovev52YcqkxX8a+cwkPnlHtxlE6iydbdOD1e1fWUp8SVtL9raYN1K5n5hUKj6uMlaQ== X-Received: by 2002:a63:4e20:: with SMTP id c32mr4200852pgb.104.1622128488280; Thu, 27 May 2021 08:14:48 -0700 (PDT) Received: from hyeyoo ([183.99.11.150]) by smtp.gmail.com with ESMTPSA id g13sm2176047pfr.75.2021.05.27.08.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 08:14:48 -0700 (PDT) Date: Fri, 28 May 2021 00:14:43 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: kernelnewbies@kernelnewbies.org Subject: Performing pointer arithmetic on a null pointer? Message-ID: <20210527151443.GA138263@hyeyoo> MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Hello, I was compiling kernel with make CC=clang-10 W=1 -s there are some places that compiler complains about pointer arithmetic like below.it says it's undefined behavior. is it just OK to use UBs like this (I hope it's not), or am I missing something? fs/kernfs/file.c:128:15: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] return NULL + !*ppos; _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies