Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4690802pxb; Sun, 6 Feb 2022 00:22:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5wAPqsLd/8q6C1pR7USCcgeHeqNOLq9RH9UXcCilF6wrhHh5kB/+UTspcVPkTOWjswu5Q X-Received: by 2002:a17:906:5e4d:: with SMTP id b13mr3226710eju.271.1644135761313; Sun, 06 Feb 2022 00:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644135761; cv=none; d=google.com; s=arc-20160816; b=GzLBiD1I1H270gtAdUd3pkjvSFCIQQ3lq98x9YfV8x1jxNnhfeo6LtT76ULTfjHfBA ShlL4+BydktuixiPKSaBoTFovYogBM8K8zE4EYF5wNtAvzgoPmRSO3T/LIqtTbxFf8dk NlzjR0drB5HBo2mhrRw1sutqWTQyWLObKSckC+DWovaLLiKtMl0TZd2VnoGH7svXPaqJ gJmp3GlNPSFFcdsyCvbbooo5F1XPLEftD0Lm7Me9nvgUOG0MNG42ipX6UUumHflqkW05 MVcblyXGUFoJH0GptHx70swCp8d8YdOYeCkazoyblDHHSMHhC+30gNnXMVdkDK6gEigp D60Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8n1I6lZO8YNpuhpdV1UDHMVFtzS1yRX/0b8aipuSNRI=; b=xHQRhRRN2SFNaO1+8iUVRK8MW7Cesebks9gTb+Cnezqpv99IckoqC8iT9QwZcDacjJ VWNzCyIm+1B5lAilEAozZxoHn0rBf10cZVzsUMs81sWfbZKz37O6tDud10lsi/AA5SzV 7VVyPN+LkEDoca8ak3KN4r9PdbElel/rx5sHOq+Rfz3/t9w0S6jOE9bbU8uMLH9+nOi2 sR6Q5o6lYknWNQCsg7eRi3oBxodo5sftdalZ/MXtv6cPvNqxzVKjRIVIozOOWOPnel3V HE7VZvPYHEeyX+Sw4/FjkzeHWzeu13qJkhMiJ6uEDcj5ku8HtLV0fn5zzFgenyQL/CEL M64g== ARC-Authentication-Results: i=1; mx.google.com; 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 e21si2642215edc.657.2022.02.06.00.22.14; Sun, 06 Feb 2022 00:22:39 -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; 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 S241125AbiBAQcl (ORCPT + 99 others); Tue, 1 Feb 2022 11:32:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241123AbiBAQcg (ORCPT ); Tue, 1 Feb 2022 11:32:36 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409A8C061714; Tue, 1 Feb 2022 08:32:36 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEw4x-006MKm-Eg; Tue, 01 Feb 2022 16:32:27 +0000 Date: Tue, 1 Feb 2022 16:32:27 +0000 From: Al Viro To: =?iso-8859-1?Q?Ma=EDra?= Canal Cc: gregkh@linuxfoundation.org, tj@kernel.org, nathan@kernel.org, ndesaulniers@google.com, willy@infradead.org, 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: Sender: Al Viro 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 > --- > V1 -> V2: > - Use SEQ_START_TOKEN instead of open-coding it > - kernfs_seq_start call single_start instead of open-coding it > V2 -> V3: > - Remove the EXPORT of the single_start symbol Applied.