public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs/befs/linuxvfs.c: need signed cast for variable 'block'
Date: Sun, 03 Nov 2013 20:41:25 +0800	[thread overview]
Message-ID: <52764475.9000205@asianux.com> (raw)
In-Reply-To: <20131102162744.GJ13318@ZenIV.linux.org.uk>

On 11/03/2013 12:27 AM, Al Viro wrote:
> On Sat, Nov 02, 2013 at 08:44:46AM -0700, Greg KH wrote:
> 
>>> Oh, for me, it is not suitable to move a file system sub-directory to
>>> "drivers/*/" sub-directory. And I can not find any sub-directory like
>>> 'staging' under "fs" sub-directory, either.
>>>
>>> Do we have any sub-directory like "staging" in "fs" sub-directory? if
>>> no, do we have to create it or have to use another ways instead of?
>>
>> Just move the filesystem to drivers/staging/befs.
> 
> Actually, having read through that code...  It's not too scary; r/w
> support would've been much more hairy, but this is just r/o.  We
> probably don't need to move that sucker at all.
> 

After a quick look, I guess we can not remove it from Linux kernel:

 - according to "fs/befs/Kconfig",
   it is only for support file system from BeOS.

 - according to "http://en.wikipedia.org/wiki/BeOS",
   BeOS is still in use (although it is almost dead).

 - according to "git log -p fs/befs",
   it is still be changed recently.

Can any members provide more proofs for it (my proofs are not enough).
if it is still using, we have to keep it in Linux kernel, else support
to remove it to some where firstly (but not "drivers/*").


> As for befs_get_block(), I'd suggest
> 	* taking the range checks for block number into its ->bmap()
> (just check against the file size and return 0 if it doesn't fit)

befs_get_block() is called both by befs_bmap() and by befs_readpage(),
and I guess Al's "->bmap()" points to befs_bmap() -- if what I guess is
incorrect, please let me know, thanks.

So for me, just remove this check "if (block < 0) { ... }" is OK which
is Kees said.

And for me, need use "%llu" not "%lu" instead of "%ld" (according to
"Documentation/printk-format.txt").


> 	* turning the check for create != 0 into BUG_ON(create)

Can we be sure of:

 - in current case, kernel/sub-system must be continuing incorrectly.
 - and if let it continue, it will cause critical issue.

If:

  can be sure of both, use BUG_ON().
  can be sure of 1st item, use WARN_ON().
  can be sure of neither, keep original no touch.

For me, if what Kees said is correct (for "ioctl ... printks ..."), I
support to use WARN_ON() which indicates "the sub-system is continuing
incorrectly, although it not a critical issue".


> 	* making the befs_fblock2brun() failure quiet - the sucker
> will complain itself, just return that -EFBIG and be done with that.
> 

Do you mean befs_fblock2brun() must be OK (should check it previously)?
If not, we cann't skip the failure -- next iaddr2blockno() may cause panic.

And for me, use "-EFBIG" is really not quite smart.

Hmm... the same reason as above (if "ioctl ... printks ..." correct),
may we need WARN_ON(), and then still return "-EFBIG"?.



BTW: the local variable 'res' can be removed.



Thanks.
-- 
Chen Gang

      reply	other threads:[~2013-11-03 12:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31  2:52 [PATCH] fs/befs/linuxvfs.c: need signed cast for variable 'block' Chen Gang
2013-10-31 16:53 ` Kees Cook
2013-10-31 19:06   ` Al Viro
2013-10-31 19:08     ` Kees Cook
2013-10-31 20:45       ` Greg KH
2013-11-01  2:41         ` Chen Gang
2013-11-02 13:46           ` Chen Gang
2013-11-02 15:44             ` Greg KH
2013-11-02 16:27               ` Al Viro
2013-11-03 12:41                 ` Chen Gang [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=52764475.9000205@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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