linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pcrypt: use format specifier in kobject_add
@ 2018-10-27 14:49 Colin King
  2018-11-09  9:53 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-10-27 14:49 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S . Miller, linux-crypto
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Passing string 'name' as the format specifier is potentially hazardous
because name could (although very unlikely to) have a format specifier
embedded in it causing issues when parsing the non-existent arguments
to these.  Follow best practice by using the "%s" format string for
the string 'name'.

Cleans up clang warning:
crypto/pcrypt.c:397:40: warning: format string is not a string literal
(potentially insecure) [-Wformat-security]

Fixes: a3fb1e330dd2 ("pcrypt: Added sysfs interface to pcrypt")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 crypto/pcrypt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index f8ec3d4ba4a8..29d2cf989c05 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -394,7 +394,7 @@ static int pcrypt_sysfs_add(struct padata_instance *pinst, const char *name)
 	int ret;
 
 	pinst->kobj.kset = pcrypt_kset;
-	ret = kobject_add(&pinst->kobj, NULL, name);
+	ret = kobject_add(&pinst->kobj, NULL, "%s", name);
 	if (!ret)
 		kobject_uevent(&pinst->kobj, KOBJ_ADD);
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pcrypt: use format specifier in kobject_add
  2018-10-27 14:49 [PATCH] pcrypt: use format specifier in kobject_add Colin King
@ 2018-11-09  9:53 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2018-11-09  9:53 UTC (permalink / raw)
  To: Colin King
  Cc: Steffen Klassert, David S . Miller, linux-crypto,
	kernel-janitors, linux-kernel

On Sat, Oct 27, 2018 at 03:49:26PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Passing string 'name' as the format specifier is potentially hazardous
> because name could (although very unlikely to) have a format specifier
> embedded in it causing issues when parsing the non-existent arguments
> to these.  Follow best practice by using the "%s" format string for
> the string 'name'.
> 
> Cleans up clang warning:
> crypto/pcrypt.c:397:40: warning: format string is not a string literal
> (potentially insecure) [-Wformat-security]
> 
> Fixes: a3fb1e330dd2 ("pcrypt: Added sysfs interface to pcrypt")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  crypto/pcrypt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-09  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-27 14:49 [PATCH] pcrypt: use format specifier in kobject_add Colin King
2018-11-09  9:53 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).