Re: [RFC][PATCH v2] configfs: Provide variants ofconfig_*_init_type_name() that report errors

From: Joel Becker
Date: Fri Jun 20 2008 - 19:21:09 EST


On Fri, Jun 20, 2008 at 05:04:11PM +0200, Louis Rilling wrote:
> void config_item_init_type_name(struct config_item *item,
> const char *name,
> struct config_item_type *type)
> {
> - config_item_set_name(item, name);
> - item->ci_type = type;
> - config_item_init(item);
> + int error;
> +
> + error = config_item_init_type_long_name(item, name, type);
> + BUG_ON(error);
> }

This needs to BUG_ON(strlen(name) >= CONIFG_ITEM_NAME_LEN) at
the top. We don't want to allow an invalid construct just because
memory happened to be available :-)
Also, update Documentation/filesystems/configfs/configfs.txt.

Joel

--

"I'm living so far beyond my income that we may almost be said
to be living apart."
- e e cummings

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@xxxxxxxxxx
Phone: (650) 506-8127
--
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/