From: Al Viro <viro@ZenIV.linux.org.uk>
To: Mike Marshall <hubcap@omnibond.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: updated orangefs tree at kernel.org
Date: Sat, 10 Oct 2015 21:23:48 +0100 [thread overview]
Message-ID: <20151010202348.GG22011@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20151010023157.GE22011@ZenIV.linux.org.uk>
May I politely inquire about the intended meaning of the following
definition?
#define MAX_ALIGNED_DEV_REQ_DOWNSIZE \
(MAX_DEV_REQ_DOWNSIZE + \
((((MAX_DEV_REQ_DOWNSIZE / \
(BITS_PER_LONG_DIV_8)) * \
(BITS_PER_LONG_DIV_8)) + \
(BITS_PER_LONG_DIV_8)) - \
MAX_DEV_REQ_DOWNSIZE))
1) (x + (y - x)) is more commonly spelled as y
2) ((x / y) * y + y) might not be doing what you think it is doing
3) aligning the thing to multiple of sizeof(long) is an odd thing
to do, seeing that the value being aligned is 16 + sizeof
of a structure that contains pointers (which is an atrocity in its
own right, BTW).
4) on the related note, what is the meaning of
static int max_downsize = MAX_ALIGNED_DEV_REQ_DOWNSIZE;
int ret = 0, num_remaining = max_downsize;
(with no code other code touching that max_downsize thing)?
5) having collected the contents of the first 4 segments of your writev()
argument and having verified that their total size does not exceed
MAX_ALIGNED_DEV_REQ_DOWNSIZE, you proceed to do this:
payload_size -= (2 * sizeof(__s32) + sizeof(__u64));
if (payload_size <= sizeof(struct pvfs2_downcall_s))
/* copy the passed in downcall into the op */
memcpy(&op->downcall,
ptr,
sizeof(struct pvfs2_downcall_s));
else
gossip_debug(GOSSIP_DEV_DEBUG,
"writev: Ignoring %d bytes\n",
payload_size);
upon the entry payload_size contains the amount of data collected. What is the
intended meaning of the 'else' branch in there? Note that it *is* possible
to hit, exactly because MAX_ALIGNED_DEV_REQ_DOWNSIZE is sizeof(long)
greater than 16 + sizeof(struct pvfs2_downcall_s). What should happen if we
do hit it? I do understand the "we shall whine" part, but then what? Leave
the op->downcall uninitialized and proceed with whatever might've been there?
That code does marshalling of userland-supplied data. Worse, the ABI is both
undocumented and utterly... I believe "idiosyncratic" would be a printable
term for that kind of thing. Sigh...
next prev parent reply other threads:[~2015-10-10 20:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 20:07 updated orangefs tree at kernel.org Mike Marshall
2015-10-08 21:07 ` Al Viro
2015-10-08 23:03 ` Al Viro
2015-10-09 3:41 ` Al Viro
2015-10-09 6:13 ` Al Viro
2015-10-09 19:22 ` Al Viro
2015-10-10 2:31 ` Al Viro
2015-10-10 20:23 ` Al Viro [this message]
2015-10-10 23:10 ` orangefs: NAK until the ABI is documented (was Re: updated orangefs tree at kernel.org) Al Viro
2015-10-12 16:20 ` Mike Marshall
2015-10-12 19:16 ` Al Viro
2015-10-13 17:46 ` Mike Marshall
2015-10-13 23:34 ` Al Viro
-- strict thread matches above, loose matches on Subject: below --
2015-11-16 20:01 updated orangefs tree at kernel.org Mike Marshall
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=20151010202348.GG22011@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=hubcap@omnibond.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).