Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Thorsten Blum and committed by
Herbert Xu
bce4678f 32c53988

+5 -4
+5 -4
drivers/crypto/intel/iaa/iaa_crypto_main.c
··· 5 5 #include <linux/kernel.h> 6 6 #include <linux/module.h> 7 7 #include <linux/pci.h> 8 + #include <linux/sysfs.h> 8 9 #include <linux/device.h> 9 10 #include <linux/iommu.h> 10 11 #include <uapi/linux/idxd.h> ··· 97 96 98 97 static ssize_t verify_compress_show(struct device_driver *driver, char *buf) 99 98 { 100 - return sprintf(buf, "%d\n", iaa_verify_compress); 99 + return sysfs_emit(buf, "%d\n", iaa_verify_compress); 101 100 } 102 101 103 102 static ssize_t verify_compress_store(struct device_driver *driver, ··· 189 188 int ret = 0; 190 189 191 190 if (!async_mode && !use_irq) 192 - ret = sprintf(buf, "%s\n", "sync"); 191 + ret = sysfs_emit(buf, "%s\n", "sync"); 193 192 else if (async_mode && !use_irq) 194 - ret = sprintf(buf, "%s\n", "async"); 193 + ret = sysfs_emit(buf, "%s\n", "async"); 195 194 else if (async_mode && use_irq) 196 - ret = sprintf(buf, "%s\n", "async_irq"); 195 + ret = sysfs_emit(buf, "%s\n", "async_irq"); 197 196 198 197 return ret; 199 198 }