diff options
| author | Thorsten Winkler <twinkler@linux.ibm.com> | 2023-06-21 16:49:21 +0300 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2023-06-23 12:55:55 +0300 |
| commit | 1471d85ffba7d17456670afa1b75e50234caa2c6 (patch) | |
| tree | d98ccc06aa26847aeb4dc1f181edabe9ba8b2b02 /drivers/s390/net/ctcm_main.c | |
| parent | d585e4b7480615031f798ef25e4012bfe53ff135 (diff) | |
| download | linux-1471d85ffba7d17456670afa1b75e50234caa2c6.tar.xz | |
s390/ctcm: Convert sprintf/snprintf to scnprintf
This LWN article explains the why scnprintf is preferred over snprintf
in general
https://lwn.net/Articles/69419/
Ie. snprintf() returns what *would* be the resulting length, while
scnprintf() returns the actual length.
Note that ctcm_print_statistics() writes the data into the kernel log
and is therefore not suitable for sysfs_emit(). Observable behavior is
not changed, as there may be dependencies.
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Thorsten Winkler <twinkler@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/s390/net/ctcm_main.c')
| -rw-r--r-- | drivers/s390/net/ctcm_main.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 28db69d91f17..6faf27136024 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c @@ -1333,7 +1333,7 @@ static int add_channel(struct ccw_device *cdev, enum ctcm_channel_types type, goto nomem_return; ch->cdev = cdev; - snprintf(ch->id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev->dev)); + scnprintf(ch->id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev->dev)); ch->type = type; /* @@ -1498,8 +1498,8 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) type = get_channel_type(&cdev0->id); - snprintf(read_id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev0->dev)); - snprintf(write_id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev1->dev)); + scnprintf(read_id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev0->dev)); + scnprintf(write_id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev1->dev)); ret = add_channel(cdev0, type, priv); if (ret) { |
