Skip to contentSkip to conversation

kobject: Add missing format attribute specifications

PATCH In review Bart Van Assche 2 participants 3 messages Jan 1, 2011 – Jan 13, 2011 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kobject: Add missing format attribute specifications

Several functions in <linux/kobject.h> accept printf-style arguments. Some of these functions have been annotated with a format attribute declaration while others have not been annotated. Add a format attribute specification where it is missing.

Cc "Greg Kroah-Hartman" <[email protected]>
---
 include/linux/kobject.h |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
include/linux/kobject.h +5 -2
index 8f6d121..15e82c1 100644
@@ -85,11 +85,13 @@ static inline const char *kobject_name(const struct kobject *kobj)
 extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
 extern int __must_check kobject_add(struct kobject *kobj,
 				    struct kobject *parent,
-				    const char *fmt, ...);
+				    const char *fmt, ...)
+	__attribute__((format(printf, 3, 4)));
 extern int __must_check kobject_init_and_add(struct kobject *kobj,
 					     struct kobj_type *ktype,
 					     struct kobject *parent,
-					     const char *fmt, ...);
+					     const char *fmt, ...)
+	__attribute__((format(printf, 4, 5)));
 
 extern void kobject_del(struct kobject *kobj);
 
@@ -226,6 +228,7 @@ static inline int kobject_uevent_env(struct kobject *kobj,
 
 static inline int add_uevent_var(struct kobj_uevent_env *env,
 				 const char *format, ...)
+	__attribute__((format(printf, 2, 3)))
 { return 0; }
 
 static inline int kobject_action_type(const char *buf, size_t count,
Signature · 1 line
1.7.1
#1 lore raw
Quoted 33 lines · On Saturday 01 January 2011 13:51:52 Bart Van Assche wrote:

Several functions in <linux/kobject.h> accept printf-style arguments. Some of these functions have been annotated with a format attribute declaration while others have not been annotated. Add a format attribute specification where it is missing.

Cc "Greg Kroah-Hartman" <[email protected]>
---
 include/linux/kobject.h |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
include/linux/kobject.h +4 -2
index 8f6d121..15e82c1 100644
@@ -85,11 +85,13 @@ static inline const char *kobject_name(const struct kobject *kobj)
 extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
 extern int __must_check kobject_add(struct kobject *kobj,
 				    struct kobject *parent,
-				    const char *fmt, ...);
+				    const char *fmt, ...)
+	__attribute__((format(printf, 3, 4)));
 extern int __must_check kobject_init_and_add(struct kobject *kobj,
 					     struct kobj_type *ktype,
 					     struct kobject *parent,
-					     const char *fmt, ...);
+					     const char *fmt, ...)
+	__attribute__((format(printf, 4, 5)));
 
 extern void kobject_del(struct kobject *kobj);
 

include/linux/kobject.h static inline int kobject_uevent_env(struct kobject *kobj, · line 234

Quoted 7 lines
include/linux/kobject.h +1 -0
@@ -226,6 +228,7 @@ static inline int kobject_uevent_env(struct kobject *kobj,
 
 static inline int add_uevent_var(struct kobj_uevent_env *env,
 				 const char *format, ...)
+	__attribute__((format(printf, 2, 3)))
 { return 0; }
 
 static inline int kobject_action_type(const char *buf, size_t count,

Hello Greg,

Have you already had the time to have a look at this patch and the two patches that can be found here: http://lkml.org/lkml/2010/12/21/97 ?

Thanks,

Bart.

#2 lore raw
Quoted 40 lines · Bart Van Assche
Quoted 39 lines · On Saturday 01 January 2011 13:51:52 Bart Van Assche wrote:

Several functions in <linux/kobject.h> accept printf-style arguments. Some of these functions have been annotated with a format attribute declaration while others have not been annotated. Add a format attribute specification where it is missing.

Cc "Greg Kroah-Hartman" <[email protected]>
---
 include/linux/kobject.h |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
include/linux/kobject.h +5 -2
index 8f6d121..15e82c1 100644
@@ -85,11 +85,13 @@ static inline const char *kobject_name(const struct kobject *kobj)
 extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
 extern int __must_check kobject_add(struct kobject *kobj,
 				    struct kobject *parent,
-				    const char *fmt, ...);
+				    const char *fmt, ...)
+	__attribute__((format(printf, 3, 4)));
 extern int __must_check kobject_init_and_add(struct kobject *kobj,
 					     struct kobj_type *ktype,
 					     struct kobject *parent,
-					     const char *fmt, ...);
+					     const char *fmt, ...)
+	__attribute__((format(printf, 4, 5)));
 
 extern void kobject_del(struct kobject *kobj);
 
@@ -226,6 +228,7 @@ static inline int kobject_uevent_env(struct kobject *kobj,
 
 static inline int add_uevent_var(struct kobj_uevent_env *env,
 				 const char *format, ...)
+	__attribute__((format(printf, 2, 3)))
 { return 0; }
 
Quoted 6 lines

include/linux/kobject.h static inline int kobject_uevent_env(struct kobject *kobj, · line 234

Quoted 1 line
include/linux/kobject.h +0 -0
 static inline int kobject_action_type(const char *buf, size_t count,

Hello Greg,

Have you already had the time to have a look at this patch and the two patches that can be found here: http://lkml.org/lkml/2010/12/21/97 ?

It's in my "to-apply" queue that I will be getting to once .38-rc1 is out. Sorry, but I was gone for a few weeks at the end of last year.

thanks for your patience,

greg k-h