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.

iio: light: isl29018: replace sprintf() with safer alternatives

This patch replaces sprintf() with sysfs_emit() and sysfs_emit_at() safer
alternative with no functional changes.

Signed-off-by: Tomas Borquez <tomasborquez13@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Tomas Borquez and committed by
Jonathan Cameron
5a306a64 ce40e01d

+6 -6
+6 -6
drivers/iio/light/isl29018.c
··· 273 273 274 274 mutex_lock(&chip->lock); 275 275 for (i = 0; i < ARRAY_SIZE(isl29018_scales[chip->int_time]); ++i) 276 - len += sprintf(buf + len, "%d.%06d ", 277 - isl29018_scales[chip->int_time][i].scale, 278 - isl29018_scales[chip->int_time][i].uscale); 276 + len += sysfs_emit_at(buf, len, "%d.%06d ", 277 + isl29018_scales[chip->int_time][i].scale, 278 + isl29018_scales[chip->int_time][i].uscale); 279 279 mutex_unlock(&chip->lock); 280 280 281 281 buf[len - 1] = '\n'; ··· 293 293 int len = 0; 294 294 295 295 for (i = 0; i < ARRAY_SIZE(isl29018_int_utimes[chip->type]); ++i) 296 - len += sprintf(buf + len, "0.%06d ", 297 - isl29018_int_utimes[chip->type][i]); 296 + len += sysfs_emit_at(buf, len, "0.%06d ", 297 + isl29018_int_utimes[chip->type][i]); 298 298 299 299 buf[len - 1] = '\n'; 300 300 ··· 330 330 * Return the "proximity scheme" i.e. if the chip does on chip 331 331 * infrared suppression (1 means perform on chip suppression) 332 332 */ 333 - return sprintf(buf, "%d\n", chip->prox_scheme); 333 + return sysfs_emit(buf, "%d\n", chip->prox_scheme); 334 334 } 335 335 336 336 static ssize_t proximity_on_chip_ambient_infrared_suppression_store