Re: [RFC/PATCH] Per-device parameter support (2/16)

From: Rusty Russell
Date: Sun Oct 24 2004 - 23:31:21 EST


On Sat, 2004-10-23 at 13:24 +0900, Tejun Heo wrote:
> dp_02_param_array_bug.diff
>
> This is the 2nd patch of 16 patches for devparam.
>
> This patches fixes param_array_set() to not use arr->max as nump
> argument of param_array. If arr->max is used as nump and the
> configuration variable is exported writeable in the syfs, the size of
> the array will be limited by the smallest number of elements
> specified. One side effect is that as the actual number of elements
> is not recorded anymore when nump is NULL, all elements should be
> printed when referencing the corresponding sysfs node. I don't think
> that will cause any problem.

I thought of this, but I prefer to see this fixed by another element in
the struct kernel_param which is used as "num" if nump is NULL.
Although this creates some bloat, it doesn't truncate as mine does, or
allow overflows and printing unset values as yours does.

(Printing unset values is usually OK, since before the new parameter
stuff, there was no way of telling how many elements had been set. This
lead authors to use a magic value for "unset". They no longer need to
do this, so we might see them start to rely on that).

Cheers,
Rusty.
--
A bad analogy is like a leaky screwdriver -- Richard Braakman

-
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/