Re: [PATCH] drivers: staging: lustre: Use mult if units not specified

From: Dan Carpenter
Date: Tue Dec 16 2014 - 04:41:43 EST


On Mon, Dec 15, 2014 at 11:41:49PM -0600, Chris Rorvick wrote:
> Units can be passed to lprocfs_write_frac_u64_helper() via a suffix
> (e.g., "...K", "...M", etc.) tacked onto the value. A comment states
> that "specified units override the multiplier," though the multiplier is
> overridden regardless. Update the conditional logic so that it only
> applies when units are specified.
>

That introduces a bug. We need to take the initial '-' into
consideration. Just remove the condition. Also remove the "mult"
parameter since that is always 1.

bool negative = false;

...

if (*pbuf == '-') {
negative = true;
pbuf++;
}

...

mult = negative ? -units : units;


regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/