Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1481064pxb; Wed, 2 Feb 2022 06:03:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWMLKceYaEfU2UIK3dqSPL+9QoZPVcfN5NODgGN4VVIkjIvigTeDPqyjTbDc04D0vZE4sG X-Received: by 2002:a17:903:1209:: with SMTP id l9mr30987827plh.124.1643810596054; Wed, 02 Feb 2022 06:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643810596; cv=none; d=google.com; s=arc-20160816; b=mafmR2GqyjsuD9WuqyWLk+vkJ3RpRijgqtjZHHwk6bLPBym2FFUTsv2PV/VYNN/pQB NaMadNP/IX8sHGwTwUMie9M28VvxdsmFTGpTOFGFHNtinYZzlmYlFfOqP/xvaWSuFgwD A6/KXrpHQicbaDlNkGAy7KdgrfaoLkNJLevHWgwLP201OxGClMnrKnOvw1QGHQBHvE4i okDs6PPppMGVIoVwrxXy56u+20R6CGkqcdTyU0bCfpToHzCN+NoeXHPKNizhAjh+uAUh ElOUbCeh3/etf9gUEpbruFBqkvUC10fgQKWBdH5HUUSu/HSkuuWtzMUZaBbbbvGRVGBD Z0Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6qWMva38m5BETEjBXB6GjYEK7Al+xJ8+7XcUp509tRY=; b=MDMkUDKIeE+B9Xw8C9QBzRl5kKgEXfTBNSsVQWpCCT6KXPhZaqT2IbTqqBXQrEWQ+m G8TQQyf7LCSWULBg4TnGVSS0Q1NLOlIQqs3bQ54SuEjzjTPezsCTGSIIE/KGMdkvReQL tn9g5ZThBts2sqVHy+QWhDEND7OHZ9X5kffSFljzOJAtlFY9YyVK+m/O9PWpxnOjQHVB TnHNaM/yMKJ/erpzS47HQtutwC3Ou0ECEnmt+cMcisIeUz1vTNfFLZ3GUvt0W9aiFgiw sxUrmMgSlWj+GLRDB6r7xzdPm0IFjNVcBXvVZXQnWW5TXjqHhp8w6pQBj+ets4piavRE 0yAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TAhLTyuy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 w13si19357235plq.358.2022.02.02.06.03.02; Wed, 02 Feb 2022 06:03:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TAhLTyuy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241080AbiBAQaa (ORCPT + 99 others); Tue, 1 Feb 2022 11:30:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbiBAQa3 (ORCPT ); Tue, 1 Feb 2022 11:30:29 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5913C061714; Tue, 1 Feb 2022 08:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=6qWMva38m5BETEjBXB6GjYEK7Al+xJ8+7XcUp509tRY=; b=TAhLTyuyC+liOj4hdGqtK7Yynq TrvpGa5hk0Vxxk1TPxnwSq28u6molarKW44pFRSqt4hezAE2eA1OJC2kuH/0lX5i84CSD5ZUMOMGN EyAD7A48j+DzV+hdVbgIbMKAVWJoEJm1lW6lAa45kEwAQKmNaWZ+U1akR0dfmLKqS1bZycR+NneeV aS11l5S5n3rtGurkfABCW+PFofosYhyXLT6FNUwO16ExHq22gWrFZNo+rOVSsGASl4rx74QSaa22/ y0yHfyUfc9YprQLL/GI3rsD2GTjKUluWEZgUseE81VPxRXoWp7hLBpskmWAqo/LHu6/qDRdLWFI3g ze5/FFbg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEw2x-00Cdb7-Qo; Tue, 01 Feb 2022 16:30:23 +0000 Date: Tue, 1 Feb 2022 16:30:23 +0000 From: Matthew Wilcox To: =?iso-8859-1?Q?Ma=EDra?= Canal Cc: gregkh@linuxfoundation.org, tj@kernel.org, viro@zeniv.linux.org.uk, nathan@kernel.org, ndesaulniers@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v3] seq_file: fix NULL pointer arithmetic warning Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 31, 2022 at 03:22:42PM -0300, Ma?ra Canal wrote: > Implement conditional logic in order to replace NULL pointer arithmetic. > > The use of NULL pointer arithmetic was pointed out by clang with the > following warning: > > fs/kernfs/file.c:128:15: warning: performing pointer arithmetic on a > null pointer has undefined behavior [-Wnull-pointer-arithmetic] > return NULL + !*ppos; > ~~~~ ^ > fs/seq_file.c:559:14: warning: performing pointer arithmetic on a > null pointer has undefined behavior [-Wnull-pointer-arithmetic] > return NULL + (*pos == 0); > > Signed-off-by: Ma?ra Canal Reviewed-by: Matthew Wilcox (Oracle)