Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp402379ybm; Thu, 28 May 2020 05:54:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHtuWFisFJJYjWYVoNSmJISig/cN2mgr9kkl53hF3tOPNWU/FwDzvrV2B0TTS8/l3S7+nd X-Received: by 2002:a17:906:17c5:: with SMTP id u5mr2733041eje.275.1590670443492; Thu, 28 May 2020 05:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590670443; cv=none; d=google.com; s=arc-20160816; b=rCG+LbJHymW4GOY6TjJgSB8B5OaFxtIolHQ/Mpatu8NBYaTfrUSXKd4V50MfNqrjoQ P88MRWTnEa3P+ZBa2DMaNOzsul4NOnFInSTp05MjAWhYugAhwJHlOkQBN004Zf3v45Ou aJv/4sn13rs1tRHCLc660aoFpfZVzNjBfwF1X3YASGm4k6ZQh3dcKli5Jw2AVXg7XDWJ aJUygAFBQjsTKlvmQgnOHN5A01Ul/8DZcsohy76FrhdZvnJmZqYdAXQ6VOIbnfiaS2Qv /aY1aCvKggeHdohLckZC4+SN9LoYhgzmfuH8BbbTnVU69OmCA3lrIdVX/MTCRpvmmHul Smrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lt0aJ/HKY3louy8TYKyi0MkEQNaEc9fCj6oIXB48VFQ=; b=G9mwknA16jHVkinxlpbf8exkxanpGegTjkEUi8Al2LrnqmF+zo7oqbP+C7DGSgDXAD eNGYhhMh/2YkVwYoikFh992MmmYxKCDtpw+oFNfriKrknyJVSx1gdPfrDDbB/72aSY38 IRy0cu8k47JLNGwaUM111rmx1YwMGQdFPfjkge53zbBh43ocUc8KmEEpSqhlBTZH02UG Na+9TLz7fWmdw6woUWXLZ0ruoutfVgZhYOZBY29HIHgcU4slKc+QpPU7AGgsY7IVRuX7 Z/FJK61eFDy66v3ybd5OjTSocgH/G9aPa7ub8qFrjdjbuYwR+crTTQ0423UcIrwQhv5R oArQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TJ92fK8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn16si4604422ejc.427.2020.05.28.05.53.39; Thu, 28 May 2020 05:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TJ92fK8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390017AbgE1Mvz (ORCPT + 99 others); Thu, 28 May 2020 08:51:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389873AbgE1Mvx (ORCPT ); Thu, 28 May 2020 08:51:53 -0400 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C90C05BD1E; Thu, 28 May 2020 05:51:53 -0700 (PDT) Received: by mail-vs1-xe42.google.com with SMTP id 1so15652160vsl.9; Thu, 28 May 2020 05:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=lt0aJ/HKY3louy8TYKyi0MkEQNaEc9fCj6oIXB48VFQ=; b=TJ92fK8qL246A8nOM5+5qXGRx3BB4SkxAQKInO/7psKXNC/ZHMNacF6wXsnsy2jdyV OzEGZYo1pcBk1/JltGEHWzI6PKDE6muiYbB2IRohny0bEkbiB7iQM/bj80YXNht5GpFD BDfrrZqiaU3Uup/yaVIbeWMfjx6kM366fMA5D4rfLlsSeZB4/JHn2/Lzj7OurLNyzjmZ sHD1vfxWk6omsxb15Vr7vIjzi6py73u8e88VJYn3gAanuwaFj20EOuq2Y3HqPDr1YU9J 1AMoeD4EC5LHEPWq5jQ9Ynea22LBVceNdk5TTd/P9kEv0FcQbBBRLYBriaxxEzZnKEqf JbRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=lt0aJ/HKY3louy8TYKyi0MkEQNaEc9fCj6oIXB48VFQ=; b=mn+9gQ2EEA/K7ioYA5L0jlbDcr3K+KpL+SmjG7GbVsY5nRrAR6JwMExkkMD6as8GKs gRxCD0yK773hP4vaEgJc5WzpIURt49tpGl8OSY+njrsW57htcrYHOZihApU5GsskuFe/ Vvox9IqBHJwbRW+EwaWF20OGRywQpLEtCzeSgXccwG4Kmcf/I5E8W/1x0+wkjel2S0Kd efb2A5N9YkqqgW7uwfnYbg8r0HQtsSYxlE+GZYDEeiKCpa7+fiCJ1PMLb1mkkic8/Dfa nq5t5biJH3zeJTK/shvYH9Fp/tVnDyWkAFcx/6koykkf9oOYXLWaXVOXJk7e1C+TK6do 9MGA== X-Gm-Message-State: AOAM532e8rl/hicf23lebAb6Az4LwEiasXLZzJQFf6HpySNS6GgbQtbW du9p78hnwJRc0qDtxzd1czG+NG+o1QJjs2pAZ0E= X-Received: by 2002:a67:e012:: with SMTP id c18mr1712875vsl.12.1590670312908; Thu, 28 May 2020 05:51:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tao pilgrim Date: Thu, 28 May 2020 20:51:41 +0800 Message-ID: Subject: Re: [PATCH] proc/fd: Remove the initialization of variables in seq_show() To: Markus Elfring Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Alexey Dobriyan , Muchun Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > The variables{files, file} will definitely be assigned, > > I find an other specification nicer for these identifiers. > > > > so we don't need to initialize them. > > I suggest to recheck programming concerns around the handling > of the null pointer for the variable =E2=80=9Cfile=E2=80=9D. > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/f= s/proc/fd.c?id=3Dcaffb99b6929f41a69edbb5aef3a359bf45f3315#n20 > https://elixir.bootlin.com/linux/v5.7-rc6/source/fs/proc/fd.c#L20 We don't need to initialize the variable =E2=80=9Cfile=E2=80=9D. On line 34, if (files) is true, {file =3D fcheck_files(files, fd)} will be executed on line 38. On line 34, if (files) is flse, {return ret;} will be executed on line 54, and seq_show() will exit directl= y. I don't find the programming concerns around the handling of the null pointer for the variable =E2=80=9Cfile=E2=80=9D. If you have other suggestions, please elaborate on the details. -- Yours, Kaitao Cheng