linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	kernel-janitors@vger.kernel.org,
	Miklos Szeredi <miklos@szeredi.hu>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [2/2] virtiofs: Improve error handling in virtio_fs_get_tree()
Date: Tue, 2 Jan 2024 16:28:44 +0000	[thread overview]
Message-ID: <ZZQ5vKRcq9kkQxSD@casper.infradead.org> (raw)
In-Reply-To: <9b27d89d-c410-4898-b801-00d2a00fb693@web.de>

On Tue, Jan 02, 2024 at 11:47:38AM +0100, Markus Elfring wrote:
> > Do you consider more clarity in your argumentation?
> 
> It is probably clear that the function call “kfree(NULL)” does not perform
> data processing which is really useful for the caller.
> Such a call is kept in some cases because programmers did not like to invest
> development resources for its avoidance.

on the contrary, it is extremely useful for callers to not have to perform
the NULL check themselves.  It also mirrors userspace where free(NULL)
is valid according to ISO/ANSI C, so eases the transition for programmers
who are coming from userspace.  It costs nothing in the implementation
as it is part of the check for the ZERO_PTR.

And from a practical point of view, we can't take it out now.  We can
never find all the places which assume the current behaviour.  So since
we must keep kfree(NULL) working, we should take advantage of that to
simplify users.

  reply	other threads:[~2024-01-02 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  8:34 [PATCH 0/2] virtiofs: Adjustments for two function implementations Markus Elfring
2023-12-29  8:36 ` [PATCH 1/2] virtiofs: Improve three size determinations Markus Elfring
2024-01-02 20:41   ` Vivek Goyal
2023-12-29  8:38 ` [PATCH 2/2] virtiofs: Improve error handling in virtio_fs_get_tree() Markus Elfring
2023-12-29  8:51   ` Matthew Wilcox
2023-12-29  9:10     ` Markus Elfring
2023-12-29 14:21       ` Matthew Wilcox
2024-01-02  9:35         ` [2/2] " Markus Elfring
2024-01-02 10:17           ` Matthew Wilcox
2024-01-02 10:47             ` Markus Elfring
2024-01-02 16:28               ` Matthew Wilcox [this message]
2024-01-02 16:50                 ` Markus Elfring
2024-01-02 20:21   ` [PATCH 2/2] " Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZQ5vKRcq9kkQxSD@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=Markus.Elfring@web.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).