Commit 40501c70 authored by Harald Freudenberger's avatar Harald Freudenberger Committed by Vasily Gorbik

s390/zcrypt: replace snprintf/sprintf with scnprintf

snprintf() may not always return the correct size of used bytes but
instead the length the resulting string would be if it would fit into
the buffer. So scnprintf() is the function to use when the real length
of the resulting string is needed.

Replace all occurrences of snprintf() with scnprintf() where the return
code is further processed. Also find and fix some occurrences where
sprintf() was used.
Suggested-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent eb3e064b
...@@ -1021,7 +1021,7 @@ EXPORT_SYMBOL(ap_parse_mask_str); ...@@ -1021,7 +1021,7 @@ EXPORT_SYMBOL(ap_parse_mask_str);
static ssize_t ap_domain_show(struct bus_type *bus, char *buf) static ssize_t ap_domain_show(struct bus_type *bus, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index);
} }
static ssize_t ap_domain_store(struct bus_type *bus, static ssize_t ap_domain_store(struct bus_type *bus,
...@@ -1047,9 +1047,9 @@ static BUS_ATTR_RW(ap_domain); ...@@ -1047,9 +1047,9 @@ static BUS_ATTR_RW(ap_domain);
static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf) static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
{ {
if (!ap_configuration) /* QCI not supported */ if (!ap_configuration) /* QCI not supported */
return snprintf(buf, PAGE_SIZE, "not supported\n"); return scnprintf(buf, PAGE_SIZE, "not supported\n");
return snprintf(buf, PAGE_SIZE, return scnprintf(buf, PAGE_SIZE,
"0x%08x%08x%08x%08x%08x%08x%08x%08x\n", "0x%08x%08x%08x%08x%08x%08x%08x%08x\n",
ap_configuration->adm[0], ap_configuration->adm[1], ap_configuration->adm[0], ap_configuration->adm[1],
ap_configuration->adm[2], ap_configuration->adm[3], ap_configuration->adm[2], ap_configuration->adm[3],
...@@ -1062,9 +1062,9 @@ static BUS_ATTR_RO(ap_control_domain_mask); ...@@ -1062,9 +1062,9 @@ static BUS_ATTR_RO(ap_control_domain_mask);
static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf) static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf)
{ {
if (!ap_configuration) /* QCI not supported */ if (!ap_configuration) /* QCI not supported */
return snprintf(buf, PAGE_SIZE, "not supported\n"); return scnprintf(buf, PAGE_SIZE, "not supported\n");
return snprintf(buf, PAGE_SIZE, return scnprintf(buf, PAGE_SIZE,
"0x%08x%08x%08x%08x%08x%08x%08x%08x\n", "0x%08x%08x%08x%08x%08x%08x%08x%08x\n",
ap_configuration->aqm[0], ap_configuration->aqm[1], ap_configuration->aqm[0], ap_configuration->aqm[1],
ap_configuration->aqm[2], ap_configuration->aqm[3], ap_configuration->aqm[2], ap_configuration->aqm[3],
...@@ -1077,9 +1077,9 @@ static BUS_ATTR_RO(ap_usage_domain_mask); ...@@ -1077,9 +1077,9 @@ static BUS_ATTR_RO(ap_usage_domain_mask);
static ssize_t ap_adapter_mask_show(struct bus_type *bus, char *buf) static ssize_t ap_adapter_mask_show(struct bus_type *bus, char *buf)
{ {
if (!ap_configuration) /* QCI not supported */ if (!ap_configuration) /* QCI not supported */
return snprintf(buf, PAGE_SIZE, "not supported\n"); return scnprintf(buf, PAGE_SIZE, "not supported\n");
return snprintf(buf, PAGE_SIZE, return scnprintf(buf, PAGE_SIZE,
"0x%08x%08x%08x%08x%08x%08x%08x%08x\n", "0x%08x%08x%08x%08x%08x%08x%08x%08x\n",
ap_configuration->apm[0], ap_configuration->apm[1], ap_configuration->apm[0], ap_configuration->apm[1],
ap_configuration->apm[2], ap_configuration->apm[3], ap_configuration->apm[2], ap_configuration->apm[3],
...@@ -1091,7 +1091,7 @@ static BUS_ATTR_RO(ap_adapter_mask); ...@@ -1091,7 +1091,7 @@ static BUS_ATTR_RO(ap_adapter_mask);
static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf) static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", return scnprintf(buf, PAGE_SIZE, "%d\n",
ap_using_interrupts() ? 1 : 0); ap_using_interrupts() ? 1 : 0);
} }
...@@ -1099,7 +1099,7 @@ static BUS_ATTR_RO(ap_interrupts); ...@@ -1099,7 +1099,7 @@ static BUS_ATTR_RO(ap_interrupts);
static ssize_t config_time_show(struct bus_type *bus, char *buf) static ssize_t config_time_show(struct bus_type *bus, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", ap_config_time); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_config_time);
} }
static ssize_t config_time_store(struct bus_type *bus, static ssize_t config_time_store(struct bus_type *bus,
...@@ -1118,7 +1118,7 @@ static BUS_ATTR_RW(config_time); ...@@ -1118,7 +1118,7 @@ static BUS_ATTR_RW(config_time);
static ssize_t poll_thread_show(struct bus_type *bus, char *buf) static ssize_t poll_thread_show(struct bus_type *bus, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", ap_poll_kthread ? 1 : 0); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_poll_kthread ? 1 : 0);
} }
static ssize_t poll_thread_store(struct bus_type *bus, static ssize_t poll_thread_store(struct bus_type *bus,
...@@ -1141,7 +1141,7 @@ static BUS_ATTR_RW(poll_thread); ...@@ -1141,7 +1141,7 @@ static BUS_ATTR_RW(poll_thread);
static ssize_t poll_timeout_show(struct bus_type *bus, char *buf) static ssize_t poll_timeout_show(struct bus_type *bus, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%llu\n", poll_timeout); return scnprintf(buf, PAGE_SIZE, "%llu\n", poll_timeout);
} }
static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf, static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
...@@ -1176,7 +1176,7 @@ static ssize_t ap_max_domain_id_show(struct bus_type *bus, char *buf) ...@@ -1176,7 +1176,7 @@ static ssize_t ap_max_domain_id_show(struct bus_type *bus, char *buf)
max_domain_id = ap_max_domain_id ? : -1; max_domain_id = ap_max_domain_id ? : -1;
else else
max_domain_id = 15; max_domain_id = 15;
return snprintf(buf, PAGE_SIZE, "%d\n", max_domain_id); return scnprintf(buf, PAGE_SIZE, "%d\n", max_domain_id);
} }
static BUS_ATTR_RO(ap_max_domain_id); static BUS_ATTR_RO(ap_max_domain_id);
...@@ -1187,7 +1187,7 @@ static ssize_t apmask_show(struct bus_type *bus, char *buf) ...@@ -1187,7 +1187,7 @@ static ssize_t apmask_show(struct bus_type *bus, char *buf)
if (mutex_lock_interruptible(&ap_perms_mutex)) if (mutex_lock_interruptible(&ap_perms_mutex))
return -ERESTARTSYS; return -ERESTARTSYS;
rc = snprintf(buf, PAGE_SIZE, rc = scnprintf(buf, PAGE_SIZE,
"0x%016lx%016lx%016lx%016lx\n", "0x%016lx%016lx%016lx%016lx\n",
ap_perms.apm[0], ap_perms.apm[1], ap_perms.apm[0], ap_perms.apm[1],
ap_perms.apm[2], ap_perms.apm[3]); ap_perms.apm[2], ap_perms.apm[3]);
...@@ -1218,7 +1218,7 @@ static ssize_t aqmask_show(struct bus_type *bus, char *buf) ...@@ -1218,7 +1218,7 @@ static ssize_t aqmask_show(struct bus_type *bus, char *buf)
if (mutex_lock_interruptible(&ap_perms_mutex)) if (mutex_lock_interruptible(&ap_perms_mutex))
return -ERESTARTSYS; return -ERESTARTSYS;
rc = snprintf(buf, PAGE_SIZE, rc = scnprintf(buf, PAGE_SIZE,
"0x%016lx%016lx%016lx%016lx\n", "0x%016lx%016lx%016lx%016lx\n",
ap_perms.aqm[0], ap_perms.aqm[1], ap_perms.aqm[0], ap_perms.aqm[1],
ap_perms.aqm[2], ap_perms.aqm[3]); ap_perms.aqm[2], ap_perms.aqm[3]);
......
...@@ -23,7 +23,7 @@ static ssize_t hwtype_show(struct device *dev, ...@@ -23,7 +23,7 @@ static ssize_t hwtype_show(struct device *dev,
{ {
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", ac->ap_dev.device_type); return scnprintf(buf, PAGE_SIZE, "%d\n", ac->ap_dev.device_type);
} }
static DEVICE_ATTR_RO(hwtype); static DEVICE_ATTR_RO(hwtype);
...@@ -33,7 +33,7 @@ static ssize_t raw_hwtype_show(struct device *dev, ...@@ -33,7 +33,7 @@ static ssize_t raw_hwtype_show(struct device *dev,
{ {
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", ac->raw_hwtype); return scnprintf(buf, PAGE_SIZE, "%d\n", ac->raw_hwtype);
} }
static DEVICE_ATTR_RO(raw_hwtype); static DEVICE_ATTR_RO(raw_hwtype);
...@@ -43,7 +43,7 @@ static ssize_t depth_show(struct device *dev, struct device_attribute *attr, ...@@ -43,7 +43,7 @@ static ssize_t depth_show(struct device *dev, struct device_attribute *attr,
{ {
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", ac->queue_depth); return scnprintf(buf, PAGE_SIZE, "%d\n", ac->queue_depth);
} }
static DEVICE_ATTR_RO(depth); static DEVICE_ATTR_RO(depth);
...@@ -53,7 +53,7 @@ static ssize_t ap_functions_show(struct device *dev, ...@@ -53,7 +53,7 @@ static ssize_t ap_functions_show(struct device *dev,
{ {
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
return snprintf(buf, PAGE_SIZE, "0x%08X\n", ac->functions); return scnprintf(buf, PAGE_SIZE, "0x%08X\n", ac->functions);
} }
static DEVICE_ATTR_RO(ap_functions); static DEVICE_ATTR_RO(ap_functions);
...@@ -69,7 +69,7 @@ static ssize_t request_count_show(struct device *dev, ...@@ -69,7 +69,7 @@ static ssize_t request_count_show(struct device *dev,
spin_lock_bh(&ap_list_lock); spin_lock_bh(&ap_list_lock);
req_cnt = atomic64_read(&ac->total_request_count); req_cnt = atomic64_read(&ac->total_request_count);
spin_unlock_bh(&ap_list_lock); spin_unlock_bh(&ap_list_lock);
return snprintf(buf, PAGE_SIZE, "%llu\n", req_cnt); return scnprintf(buf, PAGE_SIZE, "%llu\n", req_cnt);
} }
static ssize_t request_count_store(struct device *dev, static ssize_t request_count_store(struct device *dev,
...@@ -102,7 +102,7 @@ static ssize_t requestq_count_show(struct device *dev, ...@@ -102,7 +102,7 @@ static ssize_t requestq_count_show(struct device *dev,
for_each_ap_queue(aq, ac) for_each_ap_queue(aq, ac)
reqq_cnt += aq->requestq_count; reqq_cnt += aq->requestq_count;
spin_unlock_bh(&ap_list_lock); spin_unlock_bh(&ap_list_lock);
return snprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt); return scnprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt);
} }
static DEVICE_ATTR_RO(requestq_count); static DEVICE_ATTR_RO(requestq_count);
...@@ -119,7 +119,7 @@ static ssize_t pendingq_count_show(struct device *dev, ...@@ -119,7 +119,7 @@ static ssize_t pendingq_count_show(struct device *dev,
for_each_ap_queue(aq, ac) for_each_ap_queue(aq, ac)
penq_cnt += aq->pendingq_count; penq_cnt += aq->pendingq_count;
spin_unlock_bh(&ap_list_lock); spin_unlock_bh(&ap_list_lock);
return snprintf(buf, PAGE_SIZE, "%d\n", penq_cnt); return scnprintf(buf, PAGE_SIZE, "%d\n", penq_cnt);
} }
static DEVICE_ATTR_RO(pendingq_count); static DEVICE_ATTR_RO(pendingq_count);
...@@ -127,7 +127,8 @@ static DEVICE_ATTR_RO(pendingq_count); ...@@ -127,7 +127,8 @@ static DEVICE_ATTR_RO(pendingq_count);
static ssize_t modalias_show(struct device *dev, static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "ap:t%02X\n", to_ap_dev(dev)->device_type); return scnprintf(buf, PAGE_SIZE, "ap:t%02X\n",
to_ap_dev(dev)->device_type);
} }
static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(modalias);
......
...@@ -484,7 +484,7 @@ static ssize_t request_count_show(struct device *dev, ...@@ -484,7 +484,7 @@ static ssize_t request_count_show(struct device *dev,
spin_lock_bh(&aq->lock); spin_lock_bh(&aq->lock);
req_cnt = aq->total_request_count; req_cnt = aq->total_request_count;
spin_unlock_bh(&aq->lock); spin_unlock_bh(&aq->lock);
return snprintf(buf, PAGE_SIZE, "%llu\n", req_cnt); return scnprintf(buf, PAGE_SIZE, "%llu\n", req_cnt);
} }
static ssize_t request_count_store(struct device *dev, static ssize_t request_count_store(struct device *dev,
...@@ -511,7 +511,7 @@ static ssize_t requestq_count_show(struct device *dev, ...@@ -511,7 +511,7 @@ static ssize_t requestq_count_show(struct device *dev,
spin_lock_bh(&aq->lock); spin_lock_bh(&aq->lock);
reqq_cnt = aq->requestq_count; reqq_cnt = aq->requestq_count;
spin_unlock_bh(&aq->lock); spin_unlock_bh(&aq->lock);
return snprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt); return scnprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt);
} }
static DEVICE_ATTR_RO(requestq_count); static DEVICE_ATTR_RO(requestq_count);
...@@ -525,7 +525,7 @@ static ssize_t pendingq_count_show(struct device *dev, ...@@ -525,7 +525,7 @@ static ssize_t pendingq_count_show(struct device *dev,
spin_lock_bh(&aq->lock); spin_lock_bh(&aq->lock);
penq_cnt = aq->pendingq_count; penq_cnt = aq->pendingq_count;
spin_unlock_bh(&aq->lock); spin_unlock_bh(&aq->lock);
return snprintf(buf, PAGE_SIZE, "%d\n", penq_cnt); return scnprintf(buf, PAGE_SIZE, "%d\n", penq_cnt);
} }
static DEVICE_ATTR_RO(pendingq_count); static DEVICE_ATTR_RO(pendingq_count);
...@@ -540,14 +540,14 @@ static ssize_t reset_show(struct device *dev, ...@@ -540,14 +540,14 @@ static ssize_t reset_show(struct device *dev,
switch (aq->state) { switch (aq->state) {
case AP_STATE_RESET_START: case AP_STATE_RESET_START:
case AP_STATE_RESET_WAIT: case AP_STATE_RESET_WAIT:
rc = snprintf(buf, PAGE_SIZE, "Reset in progress.\n"); rc = scnprintf(buf, PAGE_SIZE, "Reset in progress.\n");
break; break;
case AP_STATE_WORKING: case AP_STATE_WORKING:
case AP_STATE_QUEUE_FULL: case AP_STATE_QUEUE_FULL:
rc = snprintf(buf, PAGE_SIZE, "Reset Timer armed.\n"); rc = scnprintf(buf, PAGE_SIZE, "Reset Timer armed.\n");
break; break;
default: default:
rc = snprintf(buf, PAGE_SIZE, "No Reset Timer set.\n"); rc = scnprintf(buf, PAGE_SIZE, "No Reset Timer set.\n");
} }
spin_unlock_bh(&aq->lock); spin_unlock_bh(&aq->lock);
return rc; return rc;
...@@ -581,11 +581,11 @@ static ssize_t interrupt_show(struct device *dev, ...@@ -581,11 +581,11 @@ static ssize_t interrupt_show(struct device *dev,
spin_lock_bh(&aq->lock); spin_lock_bh(&aq->lock);
if (aq->state == AP_STATE_SETIRQ_WAIT) if (aq->state == AP_STATE_SETIRQ_WAIT)
rc = snprintf(buf, PAGE_SIZE, "Enable Interrupt pending.\n"); rc = scnprintf(buf, PAGE_SIZE, "Enable Interrupt pending.\n");
else if (aq->interrupt == AP_INTR_ENABLED) else if (aq->interrupt == AP_INTR_ENABLED)
rc = snprintf(buf, PAGE_SIZE, "Interrupts enabled.\n"); rc = scnprintf(buf, PAGE_SIZE, "Interrupts enabled.\n");
else else
rc = snprintf(buf, PAGE_SIZE, "Interrupts disabled.\n"); rc = scnprintf(buf, PAGE_SIZE, "Interrupts disabled.\n");
spin_unlock_bh(&aq->lock); spin_unlock_bh(&aq->lock);
return rc; return rc;
} }
......
...@@ -41,7 +41,7 @@ static ssize_t type_show(struct device *dev, ...@@ -41,7 +41,7 @@ static ssize_t type_show(struct device *dev,
{ {
struct zcrypt_card *zc = to_ap_card(dev)->private; struct zcrypt_card *zc = to_ap_card(dev)->private;
return snprintf(buf, PAGE_SIZE, "%s\n", zc->type_string); return scnprintf(buf, PAGE_SIZE, "%s\n", zc->type_string);
} }
static DEVICE_ATTR_RO(type); static DEVICE_ATTR_RO(type);
...@@ -52,7 +52,7 @@ static ssize_t online_show(struct device *dev, ...@@ -52,7 +52,7 @@ static ssize_t online_show(struct device *dev,
{ {
struct zcrypt_card *zc = to_ap_card(dev)->private; struct zcrypt_card *zc = to_ap_card(dev)->private;
return snprintf(buf, PAGE_SIZE, "%d\n", zc->online); return scnprintf(buf, PAGE_SIZE, "%d\n", zc->online);
} }
static ssize_t online_store(struct device *dev, static ssize_t online_store(struct device *dev,
...@@ -86,7 +86,7 @@ static ssize_t load_show(struct device *dev, ...@@ -86,7 +86,7 @@ static ssize_t load_show(struct device *dev,
{ {
struct zcrypt_card *zc = to_ap_card(dev)->private; struct zcrypt_card *zc = to_ap_card(dev)->private;
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zc->load)); return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zc->load));
} }
static DEVICE_ATTR_RO(load); static DEVICE_ATTR_RO(load);
......
...@@ -87,7 +87,7 @@ static ssize_t cca_serialnr_show(struct device *dev, ...@@ -87,7 +87,7 @@ static ssize_t cca_serialnr_show(struct device *dev,
if (ap_domain_index >= 0) if (ap_domain_index >= 0)
cca_get_info(ac->id, ap_domain_index, &ci, zc->online); cca_get_info(ac->id, ap_domain_index, &ci, zc->online);
return snprintf(buf, PAGE_SIZE, "%s\n", ci.serial); return scnprintf(buf, PAGE_SIZE, "%s\n", ci.serial);
} }
static struct device_attribute dev_attr_cca_serialnr = static struct device_attribute dev_attr_cca_serialnr =
...@@ -122,10 +122,10 @@ static ssize_t cca_mkvps_show(struct device *dev, ...@@ -122,10 +122,10 @@ static ssize_t cca_mkvps_show(struct device *dev,
&ci, zq->online); &ci, zq->online);
if (ci.new_mk_state >= '1' && ci.new_mk_state <= '3') if (ci.new_mk_state >= '1' && ci.new_mk_state <= '3')
n = snprintf(buf, PAGE_SIZE, "AES NEW: %s 0x%016llx\n", n = scnprintf(buf, PAGE_SIZE, "AES NEW: %s 0x%016llx\n",
new_state[ci.new_mk_state - '1'], ci.new_mkvp); new_state[ci.new_mk_state - '1'], ci.new_mkvp);
else else
n = snprintf(buf, PAGE_SIZE, "AES NEW: - -\n"); n = scnprintf(buf, PAGE_SIZE, "AES NEW: - -\n");
if (ci.cur_mk_state >= '1' && ci.cur_mk_state <= '2') if (ci.cur_mk_state >= '1' && ci.cur_mk_state <= '2')
n += scnprintf(buf + n, PAGE_SIZE - n, n += scnprintf(buf + n, PAGE_SIZE - n,
...@@ -172,9 +172,9 @@ static ssize_t ep11_api_ordinalnr_show(struct device *dev, ...@@ -172,9 +172,9 @@ static ssize_t ep11_api_ordinalnr_show(struct device *dev,
ep11_get_card_info(ac->id, &ci, zc->online); ep11_get_card_info(ac->id, &ci, zc->online);
if (ci.API_ord_nr > 0) if (ci.API_ord_nr > 0)
return snprintf(buf, PAGE_SIZE, "%u\n", ci.API_ord_nr); return scnprintf(buf, PAGE_SIZE, "%u\n", ci.API_ord_nr);
else else
return snprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
} }
static struct device_attribute dev_attr_ep11_api_ordinalnr = static struct device_attribute dev_attr_ep11_api_ordinalnr =
...@@ -193,11 +193,11 @@ static ssize_t ep11_fw_version_show(struct device *dev, ...@@ -193,11 +193,11 @@ static ssize_t ep11_fw_version_show(struct device *dev,
ep11_get_card_info(ac->id, &ci, zc->online); ep11_get_card_info(ac->id, &ci, zc->online);
if (ci.FW_version > 0) if (ci.FW_version > 0)
return snprintf(buf, PAGE_SIZE, "%d.%d\n", return scnprintf(buf, PAGE_SIZE, "%d.%d\n",
(int)(ci.FW_version >> 8), (int)(ci.FW_version >> 8),
(int)(ci.FW_version & 0xFF)); (int)(ci.FW_version & 0xFF));
else else
return snprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
} }
static struct device_attribute dev_attr_ep11_fw_version = static struct device_attribute dev_attr_ep11_fw_version =
...@@ -216,9 +216,9 @@ static ssize_t ep11_serialnr_show(struct device *dev, ...@@ -216,9 +216,9 @@ static ssize_t ep11_serialnr_show(struct device *dev,
ep11_get_card_info(ac->id, &ci, zc->online); ep11_get_card_info(ac->id, &ci, zc->online);
if (ci.serial[0]) if (ci.serial[0])
return snprintf(buf, PAGE_SIZE, "%16.16s\n", ci.serial); return scnprintf(buf, PAGE_SIZE, "%16.16s\n", ci.serial);
else else
return snprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
} }
static struct device_attribute dev_attr_ep11_serialnr = static struct device_attribute dev_attr_ep11_serialnr =
...@@ -300,16 +300,16 @@ static ssize_t ep11_mkvps_show(struct device *dev, ...@@ -300,16 +300,16 @@ static ssize_t ep11_mkvps_show(struct device *dev,
&di); &di);
if (di.cur_wk_state == '0') { if (di.cur_wk_state == '0') {
n = snprintf(buf, PAGE_SIZE, "WK CUR: %s -\n", n = scnprintf(buf, PAGE_SIZE, "WK CUR: %s -\n",
cwk_state[di.cur_wk_state - '0']); cwk_state[di.cur_wk_state - '0']);
} else if (di.cur_wk_state == '1') { } else if (di.cur_wk_state == '1') {
n = snprintf(buf, PAGE_SIZE, "WK CUR: %s 0x", n = scnprintf(buf, PAGE_SIZE, "WK CUR: %s 0x",
cwk_state[di.cur_wk_state - '0']); cwk_state[di.cur_wk_state - '0']);
bin2hex(buf + n, di.cur_wkvp, sizeof(di.cur_wkvp)); bin2hex(buf + n, di.cur_wkvp, sizeof(di.cur_wkvp));
n += 2 * sizeof(di.cur_wkvp); n += 2 * sizeof(di.cur_wkvp);
n += scnprintf(buf + n, PAGE_SIZE - n, "\n"); n += scnprintf(buf + n, PAGE_SIZE - n, "\n");
} else } else
n = snprintf(buf, PAGE_SIZE, "WK CUR: - -\n"); n = scnprintf(buf, PAGE_SIZE, "WK CUR: - -\n");
if (di.new_wk_state == '0') { if (di.new_wk_state == '0') {
n += scnprintf(buf + n, PAGE_SIZE - n, "WK NEW: %s -\n", n += scnprintf(buf + n, PAGE_SIZE - n, "WK NEW: %s -\n",
......
...@@ -42,7 +42,7 @@ static ssize_t online_show(struct device *dev, ...@@ -42,7 +42,7 @@ static ssize_t online_show(struct device *dev,
{ {
struct zcrypt_queue *zq = to_ap_queue(dev)->private; struct zcrypt_queue *zq = to_ap_queue(dev)->private;
return snprintf(buf, PAGE_SIZE, "%d\n", zq->online); return scnprintf(buf, PAGE_SIZE, "%d\n", zq->online);
} }
static ssize_t online_store(struct device *dev, static ssize_t online_store(struct device *dev,
...@@ -78,7 +78,7 @@ static ssize_t load_show(struct device *dev, ...@@ -78,7 +78,7 @@ static ssize_t load_show(struct device *dev,
{ {
struct zcrypt_queue *zq = to_ap_queue(dev)->private; struct zcrypt_queue *zq = to_ap_queue(dev)->private;
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zq->load)); return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zq->load));
} }
static DEVICE_ATTR_RO(load); static DEVICE_ATTR_RO(load);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment