* [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit
@ 2021-04-12 8:39 Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 1/3] iio:chemical:sps30: Convert sysfs sprintf/snprintf family " Tian Tao
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Tian Tao @ 2021-04-12 8:39 UTC (permalink / raw)
To: jic23, tduszyns, mcoquelin.stm32, alexandre.torgue; +Cc: linux-iio, Tian Tao
Use the generic sysfs_emit() function to take place of
sprintf/snprintf/scnprintf, to avoid buffer overrun.
Tian Tao (3):
iio:chemical:sps30: Convert sysfs sprintf/snprintf family to
sysfs_emit
iio: light: Convert sysfs sprintf/snprintf family to sysfs_emit
iio: trigger: stm32-timer: Convert sysfs sprintf/snprintf family to
sysfs_emit
drivers/iio/chemical/sps30.c | 6 +++---
drivers/iio/light/veml6030.c | 2 +-
drivers/iio/trigger/stm32-timer-trigger.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH drivers/iio 1/3] iio:chemical:sps30: Convert sysfs sprintf/snprintf family to sysfs_emit
2021-04-12 8:39 [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit Tian Tao
@ 2021-04-12 8:39 ` Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 2/3] iio: light: " Tian Tao
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Tian Tao @ 2021-04-12 8:39 UTC (permalink / raw)
To: jic23, tduszyns, mcoquelin.stm32, alexandre.torgue; +Cc: linux-iio, Tian Tao
Fix the following coccicheck warning:
./drivers/iio/chemical/sps30.c:414:8-16: WARNING:
use scnprintf or sprintf
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
drivers/iio/chemical/sps30.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
index 2ea9a5c..7486591 100644
--- a/drivers/iio/chemical/sps30.c
+++ b/drivers/iio/chemical/sps30.c
@@ -411,9 +411,9 @@ static ssize_t cleaning_period_available_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "[%d %d %d]\n",
- SPS30_AUTO_CLEANING_PERIOD_MIN, 1,
- SPS30_AUTO_CLEANING_PERIOD_MAX);
+ return sysfs_emit(buf, "[%d %d %d]\n",
+ SPS30_AUTO_CLEANING_PERIOD_MIN, 1,
+ SPS30_AUTO_CLEANING_PERIOD_MAX);
}
static IIO_DEVICE_ATTR_WO(start_cleaning, 0);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH drivers/iio 2/3] iio: light: Convert sysfs sprintf/snprintf family to sysfs_emit
2021-04-12 8:39 [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 1/3] iio:chemical:sps30: Convert sysfs sprintf/snprintf family " Tian Tao
@ 2021-04-12 8:39 ` Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 3/3] iio: trigger: stm32-timer: " Tian Tao
2021-04-18 10:06 ` [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf " Jonathan Cameron
3 siblings, 0 replies; 5+ messages in thread
From: Tian Tao @ 2021-04-12 8:39 UTC (permalink / raw)
To: jic23, tduszyns, mcoquelin.stm32, alexandre.torgue; +Cc: linux-iio, Tian Tao
Fix the following coccicheck warning:
drivers/iio/light/veml6030.c:131:8-16: WARNING:
use scnprintf or sprintf
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
drivers/iio/light/veml6030.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
index de85c9b..3c937c5 100644
--- a/drivers/iio/light/veml6030.c
+++ b/drivers/iio/light/veml6030.c
@@ -128,7 +128,7 @@ static ssize_t in_illuminance_period_available_show(struct device *dev,
return -EINVAL;
}
- return snprintf(buf, PAGE_SIZE, "%s\n", period_values[x]);
+ return sysfs_emit(buf, "%s\n", period_values[x]);
}
static IIO_DEVICE_ATTR_RO(in_illuminance_period_available, 0);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH drivers/iio 3/3] iio: trigger: stm32-timer: Convert sysfs sprintf/snprintf family to sysfs_emit
2021-04-12 8:39 [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 1/3] iio:chemical:sps30: Convert sysfs sprintf/snprintf family " Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 2/3] iio: light: " Tian Tao
@ 2021-04-12 8:39 ` Tian Tao
2021-04-18 10:06 ` [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf " Jonathan Cameron
3 siblings, 0 replies; 5+ messages in thread
From: Tian Tao @ 2021-04-12 8:39 UTC (permalink / raw)
To: jic23, tduszyns, mcoquelin.stm32, alexandre.torgue; +Cc: linux-iio, Tian Tao
Fix the following coccicheck warning:
drivers/iio/trigger/stm32-timer-trigger.c:299:8-16: WARNING:
use scnprintf or sprintf
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
drivers/iio/trigger/stm32-timer-trigger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
index 3aa9e8b..3308387 100644
--- a/drivers/iio/trigger/stm32-timer-trigger.c
+++ b/drivers/iio/trigger/stm32-timer-trigger.c
@@ -296,7 +296,7 @@ static ssize_t stm32_tt_show_master_mode(struct device *dev,
else
cr2 = (cr2 & TIM_CR2_MMS) >> TIM_CR2_MMS_SHIFT;
- return snprintf(buf, PAGE_SIZE, "%s\n", master_mode_table[cr2]);
+ return sysfs_emit(buf, "%s\n", master_mode_table[cr2]);
}
static ssize_t stm32_tt_store_master_mode(struct device *dev,
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit
2021-04-12 8:39 [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit Tian Tao
` (2 preceding siblings ...)
2021-04-12 8:39 ` [PATCH drivers/iio 3/3] iio: trigger: stm32-timer: " Tian Tao
@ 2021-04-18 10:06 ` Jonathan Cameron
3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2021-04-18 10:06 UTC (permalink / raw)
To: Tian Tao; +Cc: tduszyns, mcoquelin.stm32, alexandre.torgue, linux-iio
On Mon, 12 Apr 2021 16:39:08 +0800
Tian Tao <tiantao6@hisilicon.com> wrote:
> Use the generic sysfs_emit() function to take place of
> sprintf/snprintf/scnprintf, to avoid buffer overrun.
>
> Tian Tao (3):
> iio:chemical:sps30: Convert sysfs sprintf/snprintf family to
> sysfs_emit
> iio: light: Convert sysfs sprintf/snprintf family to sysfs_emit
> iio: trigger: stm32-timer: Convert sysfs sprintf/snprintf family to
> sysfs_emit
>
> drivers/iio/chemical/sps30.c | 6 +++---
> drivers/iio/light/veml6030.c | 2 +-
> drivers/iio/trigger/stm32-timer-trigger.c | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
Series applied to the togreg branch of iio.git and pushed out as testing
to let the autobuilders see if they can find anything we missed.
This won't got upstream until after the merge window so plenty of time
for others to take a look if they want to.
Thanks,
Jonathan
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-18 10:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 8:39 [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf to sysfs_emit Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 1/3] iio:chemical:sps30: Convert sysfs sprintf/snprintf family " Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 2/3] iio: light: " Tian Tao
2021-04-12 8:39 ` [PATCH drivers/iio 3/3] iio: trigger: stm32-timer: " Tian Tao
2021-04-18 10:06 ` [PATCH drivers/iio 0/3] convert sysfs sprintf/snprintf/scnprintf " Jonathan Cameron
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).