* [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions
@ 2025-12-15 7:23 Thorsten Blum
2025-12-19 19:00 ` Sridhar, Kanchana P
2025-12-29 0:49 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-12-15 7:23 UTC (permalink / raw)
To: Kristen Accardi, Vinicius Costa Gomes, Kanchana P Sridhar,
Herbert Xu, David S. Miller
Cc: Thorsten Blum, linux-crypto, linux-kernel
Replace sprintf() with sysfs_emit() in verify_compress_show() and
sync_mode_show(). sysfs_emit() is preferred to format sysfs output as it
provides better bounds checking. No functional changes.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/crypto/intel/iaa/iaa_crypto_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c
index d0058757b000..9e2a17c473ef 100644
--- a/drivers/crypto/intel/iaa/iaa_crypto_main.c
+++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c
@@ -5,6 +5,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/sysfs.h>
#include <linux/device.h>
#include <linux/iommu.h>
#include <uapi/linux/idxd.h>
@@ -96,7 +97,7 @@ static bool iaa_verify_compress = true;
static ssize_t verify_compress_show(struct device_driver *driver, char *buf)
{
- return sprintf(buf, "%d\n", iaa_verify_compress);
+ return sysfs_emit(buf, "%d\n", iaa_verify_compress);
}
static ssize_t verify_compress_store(struct device_driver *driver,
@@ -188,11 +189,11 @@ static ssize_t sync_mode_show(struct device_driver *driver, char *buf)
int ret = 0;
if (!async_mode && !use_irq)
- ret = sprintf(buf, "%s\n", "sync");
+ ret = sysfs_emit(buf, "%s\n", "sync");
else if (async_mode && !use_irq)
- ret = sprintf(buf, "%s\n", "async");
+ ret = sysfs_emit(buf, "%s\n", "async");
else if (async_mode && use_irq)
- ret = sprintf(buf, "%s\n", "async_irq");
+ ret = sysfs_emit(buf, "%s\n", "async_irq");
return ret;
}
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions
2025-12-15 7:23 [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions Thorsten Blum
@ 2025-12-19 19:00 ` Sridhar, Kanchana P
2025-12-29 0:49 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Sridhar, Kanchana P @ 2025-12-19 19:00 UTC (permalink / raw)
To: Thorsten Blum, Accardi, Kristen C, Gomes, Vinicius, Herbert Xu,
David S. Miller
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Sridhar, Kanchana P
> -----Original Message-----
> From: Thorsten Blum <thorsten.blum@linux.dev>
> Sent: Sunday, December 14, 2025 11:24 PM
> To: Accardi, Kristen C <kristen.c.accardi@intel.com>; Gomes, Vinicius
> <vinicius.gomes@intel.com>; Sridhar, Kanchana P
> <kanchana.p.sridhar@intel.com>; Herbert Xu
> <herbert@gondor.apana.org.au>; David S. Miller <davem@davemloft.net>
> Cc: Thorsten Blum <thorsten.blum@linux.dev>; linux-crypto@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show
> functions
>
> Replace sprintf() with sysfs_emit() in verify_compress_show() and
> sync_mode_show(). sysfs_emit() is preferred to format sysfs output as it
> provides better bounds checking. No functional changes.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
> ---
> drivers/crypto/intel/iaa/iaa_crypto_main.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c
> b/drivers/crypto/intel/iaa/iaa_crypto_main.c
> index d0058757b000..9e2a17c473ef 100644
> --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c
> +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c
> @@ -5,6 +5,7 @@
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/pci.h>
> +#include <linux/sysfs.h>
> #include <linux/device.h>
> #include <linux/iommu.h>
> #include <uapi/linux/idxd.h>
> @@ -96,7 +97,7 @@ static bool iaa_verify_compress = true;
>
> static ssize_t verify_compress_show(struct device_driver *driver, char *buf)
> {
> - return sprintf(buf, "%d\n", iaa_verify_compress);
> + return sysfs_emit(buf, "%d\n", iaa_verify_compress);
> }
>
> static ssize_t verify_compress_store(struct device_driver *driver,
> @@ -188,11 +189,11 @@ static ssize_t sync_mode_show(struct
> device_driver *driver, char *buf)
> int ret = 0;
>
> if (!async_mode && !use_irq)
> - ret = sprintf(buf, "%s\n", "sync");
> + ret = sysfs_emit(buf, "%s\n", "sync");
> else if (async_mode && !use_irq)
> - ret = sprintf(buf, "%s\n", "async");
> + ret = sysfs_emit(buf, "%s\n", "async");
> else if (async_mode && use_irq)
> - ret = sprintf(buf, "%s\n", "async_irq");
> + ret = sysfs_emit(buf, "%s\n", "async_irq");
>
> return ret;
> }
> --
> Thorsten Blum <thorsten.blum@linux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions
2025-12-15 7:23 [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions Thorsten Blum
2025-12-19 19:00 ` Sridhar, Kanchana P
@ 2025-12-29 0:49 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2025-12-29 0:49 UTC (permalink / raw)
To: Thorsten Blum
Cc: Kristen Accardi, Vinicius Costa Gomes, Kanchana P Sridhar,
David S. Miller, linux-crypto, linux-kernel
On Mon, Dec 15, 2025 at 08:23:52AM +0100, Thorsten Blum wrote:
> Replace sprintf() with sysfs_emit() in verify_compress_show() and
> sync_mode_show(). sysfs_emit() is preferred to format sysfs output as it
> provides better bounds checking. No functional changes.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/crypto/intel/iaa/iaa_crypto_main.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
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] 3+ messages in thread
end of thread, other threads:[~2025-12-29 0:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 7:23 [PATCH] crypto: iaa - Replace sprintf with sysfs_emit in sysfs show functions Thorsten Blum
2025-12-19 19:00 ` Sridhar, Kanchana P
2025-12-29 0:49 ` 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).