All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: rtg.canonical@gmail.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tim Gardner <tim.gardner@canonical.com>
Subject: Re: [PATCH v2] fs: namespace: suppress 'may be used uninitialized' warnings
Date: Thu, 28 Aug 2014 15:32:43 +0100	[thread overview]
Message-ID: <20140828143243.GH18016@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1409234149-3485-1-git-send-email-tim.gardner@canonical.com>

On Thu, Aug 28, 2014 at 07:55:49AM -0600, rtg.canonical@gmail.com wrote:
> From: Tim Gardner <tim.gardner@canonical.com>
> 
> The gcc version 4.9.1 compiler complains even though it isn't possible for
> these variables to not get initialized before they are used.

Sigh...  The root cause of that shite is that copy_mount_string() is too
convoluted for gcc (piss-poor) detection of uninitialized variables.  And
yes, it is somewhat overcomplicated - it returns 0 or -E... *and* in former
case it returns NULL or a string as well, via a char ** argument.

The usual convention for such suckers is "return a pointer, using
ERR_PTR(-E...) to indicate an error".  We have all of 4 (four) callers,
all in fs/*.c (and nobody else could see that function, unless they manually
included fs/internal.h).

So let's turn that into
char *copy_mount_string(const void __user *data)
{
	return data ? strndup_user(data, PAGE_SIZE) : NULL;
}

and uses of that thing into
        kernel_type = copy_mount_string(type);
	ret = PTR_ERR(kernel_type);
        if (IS_ERR(kernel_type))
                goto out_type;
etc.

  reply	other threads:[~2014-08-28 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 19:51 [PATCH 3.17-rc2] fs: namespace: suppress 'may be used uninitialized' warnings rtg.canonical
2014-08-27 19:51 ` rtg.canonical
2014-08-27 21:01 ` Al Viro
2014-08-28 13:55   ` [PATCH v2] " rtg.canonical
2014-08-28 14:32     ` Al Viro [this message]
2014-08-28 17:26       ` [PATCH v3] " rtg.canonical

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=20140828143243.GH18016@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtg.canonical@gmail.com \
    --cc=tim.gardner@canonical.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.