Thread (24 messages) 24 messages, 3 authors, 2012-09-28

Re: [PATCH 1/2] Btrfs: cleanup duplicated division functions

From: Ilya Dryomov <idryomov@gmail.com>
Date: 2012-09-17 12:07:42

On Mon, Sep 17, 2012 at 10:21:00AM +0800, Miao Xie wrote:
On fri, 14 Sep 2012 15:54:18 +0200, David Sterba wrote:
quoted
On Thu, Sep 13, 2012 at 06:51:36PM +0800, Miao Xie wrote:
quoted
div_factor{_fine} has been implemented for two times, cleanup it.
And I move them into a independent file named math.h because they are
common math functions.
You removed the sanity checks:

-       if (factor <= 0)
-               return 0;
-       if (factor >= 100)
-               return num;
As inline functions, they should not contain complex checks, the caller should
make sure the parameters are right. I think.
div_factor_fine() in volumes.c is not inline, and is called from
chunk_usage_filter() on unvalidated user input.  If you think the caller
should do those checks, you should move them to the caller as part of
your patch.

Thanks,

		Ilya
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help