On Fri, Mar 14, 2014 at 10:38:40AM -0700, Joe Perches wrote:> > +static int queue_depth = 64; > > +module_param(queue_depth, int, 444); > > 444? Really Ted?Oops, *blush*. Thanks for catching that. - Ted
Theodore Ts'o <tytso at mit.edu> writes:> On Fri, Mar 14, 2014 at 10:38:40AM -0700, Joe Perches wrote: >> > +static int queue_depth = 64; >> > +module_param(queue_depth, int, 444); >> >> 444? Really Ted? > > Oops, *blush*. Thanks for catching that.Erk, our tests are insufficient. Testbuilding an allmodconfig with this now: diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 175f6995d1af..626b85888a6b 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -188,6 +188,9 @@ struct kparam_array /* Default value instead of permissions? */ \ static int __param_perm_check_##name __attribute__((unused)) = \ BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ + /* User perms >= group perms >= other perms. */ \ + + BUILD_BUG_ON_ZERO(((perm) >> 6) < (((perm) >> 3) & 7)) \ + + BUILD_BUG_ON_ZERO((((perm) >> 3) & 7) < ((perm) & 7)) \ + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \ static const char __param_str_##name[] = prefix #name; \ static struct kernel_param __moduleparam_const __param_##name \
On Mon, 2014-03-17 at 14:25 +1030, Rusty Russell wrote:> Erk, our tests are insufficient. Testbuilding an allmodconfig with this > now:Good idea.> diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h[]> @@ -188,6 +188,9 @@ struct kparam_array > /* Default value instead of permissions? */ \ > static int __param_perm_check_##name __attribute__((unused)) = \ > BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ > + /* User perms >= group perms >= other perms. */ \ > + + BUILD_BUG_ON_ZERO(((perm) >> 6) < (((perm) >> 3) & 7)) \ > + + BUILD_BUG_ON_ZERO((((perm) >> 3) & 7) < ((perm) & 7)) \ > + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \ > static const char __param_str_##name[] = prefix #name; \ > static struct kernel_param __moduleparam_const __param_##name \It might make sense to separate this octal permissions test into a new macro for other checks in macros like CLASS_ATTR, DEVICE_ATTR, SENSOR_ATTR and SENSOR_ATTR_2. Maybe something like: #define VERIFY_OCTAL_PERMISSIONS(perm) \ static int __param_perm_check_##name __attribute__((unused)) = \ BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ /* User perms >= group perms >= other perms. */ \ + BUILD_BUG_ON_ZERO(((perm) >> 6) < (((perm) >> 3) & 7)) \ + BUILD_BUG_ON_ZERO((((perm) >> 3) & 7) < ((perm) & 7)); \
Reasonably Related Threads
- [PATCH] virtio-blk: make the queue depth configurable
- [PATCH] virtio-blk: make the queue depth configurable
- [PATCH] virtio-blk: make the queue depth configurable
- [PATCH] virtio-blk: make the queue depth configurable
- [PATCH] virtio-blk: make the queue depth configurable