driver core: make kobj_type constant.

This way instances of kobj_type (which contain function pointers) can be
stored in .rodata, which means that they cannot be [easily/accidentally]
modified at runtime.

Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
Link: https://lore.kernel.org/r/20211224231345.777370-1-wedsonaf@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Wedson Almeida Filho 2021-12-24 23:13:45 +00:00 committed by Greg Kroah-Hartman
parent 67e532a42c
commit ee6d3dd4ed
6 changed files with 13 additions and 13 deletions

View file

@ -928,7 +928,7 @@ static const struct sysfs_ops module_sysfs_ops = {
static int uevent_filter(struct kset *kset, struct kobject *kobj)
{
struct kobj_type *ktype = get_ktype(kobj);
const struct kobj_type *ktype = get_ktype(kobj);
if (ktype == &module_ktype)
return 1;