From: Eric Sandeen <sandeen@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>,
Christoph Hellwig <hch@infradead.org>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] misc: fix more stupid compiler warnings
Date: Sun, 3 Sep 2017 20:01:36 -0500 [thread overview]
Message-ID: <ab0468ce-2ab4-3ed9-e065-799ff2194039@redhat.com> (raw)
In-Reply-To: <20170904002235.GB4671@magnolia>
On 9/3/17 7:22 PM, Darrick J. Wong wrote:
> On Sun, Sep 03, 2017 at 12:24:33AM -0700, Christoph Hellwig wrote:
>> Can you splits this up a bit to be more self explanatory, e.g.
>> one patch per warning class or logical change?
>>
>>> if (be32_to_cpu(free->hdr.nvalid) > maxent ||
>>> - be32_to_cpu(free->hdr.nvalid) < 0 ||
>>> be32_to_cpu(free->hdr.nused) > maxent ||
>>> - be32_to_cpu(free->hdr.nused) < 0 ||
>>> be32_to_cpu(free->hdr.nused) >
>>> be32_to_cpu(free->hdr.nvalid)) {
>>
>> be32_to_cpu returns uint, so this makese sense.
>>
>>> - (void)getcwd(curdir,MAXPATHLEN);
>>> + if (!getcwd(curdir, MAXPATHLEN)) {
>>> + perror("getcwd");
>>> + strcpy(curdir, ".");
>>> + }
>>
>> All this chdir magic will need a lot more explanation. To me it
>> seems like most of this is a left over from IRIX days where we
>> could have device names relative to a volume. The proper fix
>> probably is to just remove that whole thing - if we'd ever
>> need to bring it back we should use openat relative to a dirfd
>> instead.
>
> Yeah, AFAICT all this getcwd/chdir stuff seems to exist so that
> check_open can change the working directory (it doesn't on Linux) and we
> can change back to continue to use relative paths. Nothing ever changes
> the directory (at least not in the call paths of libxfs_init) so I think
> we can just rip it out. As a separate patch.
>
> In the meantime, do you want me to resend with just the uncontroversial
> bits?
The rest is all fine with me, sorry, I should have said that as well.
I agree with Christoph that splitting into logically grouped changes
makes sense; I was going to let that slide, but it always has been
and still is best practice, of course.
As for moving that ASSERT - yeah, at one point we said that if a null
ptr deref is going to happen immediately after, the ASSERT is really
of no value.
-Eric
prev parent reply other threads:[~2017-09-04 1:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-01 22:21 [PATCH] misc: fix more stupid compiler warnings Darrick J. Wong
2017-09-03 3:41 ` Eric Sandeen
2017-09-03 7:24 ` Christoph Hellwig
2017-09-04 0:22 ` Darrick J. Wong
2017-09-04 1:01 ` Eric Sandeen [this message]
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=ab0468ce-2ab4-3ed9-e065-799ff2194039@redhat.com \
--to=sandeen@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
/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