* [patch] iscsi-target: make some temporary buffers larger
@ 2013-01-24 7:06 Dan Carpenter
2013-01-29 18:56 ` Nicholas A. Bellinger
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-01-24 7:06 UTC (permalink / raw)
To: kernel-janitors
My static checker complains because we use sprintf() to print some
unsigned ints into 10 byte buffers. In theory unsigned ints can take 10
characters and we need another for the terminator.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
index d891642..ca2be40 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.c
+++ b/drivers/target/iscsi/iscsi_target_parameters.c
@@ -1095,11 +1095,11 @@ static int iscsi_check_acceptor_state(struct iscsi_param *param, char *value,
SET_PSTATE_REPLY_OPTIONAL(param);
}
} else if (IS_TYPE_NUMBER(param)) {
- char *tmpptr, buf[10];
+ char *tmpptr, buf[11];
u32 acceptor_value = simple_strtoul(param->value, &tmpptr, 0);
u32 proposer_value = simple_strtoul(value, &tmpptr, 0);
- memset(buf, 0, 10);
+ memset(buf, 0, sizeof(buf));
if (!strcmp(param->name, MAXCONNECTIONS) ||
!strcmp(param->name, MAXBURSTLENGTH) ||
@@ -1503,8 +1503,8 @@ static int iscsi_enforce_integrity_rules(
FirstBurstLength = simple_strtoul(param->value,
&tmpptr, 0);
if (FirstBurstLength > MaxBurstLength) {
- char tmpbuf[10];
- memset(tmpbuf, 0, 10);
+ char tmpbuf[11];
+ memset(tmpbuf, 0, sizeof(tmpbuf));
sprintf(tmpbuf, "%u", MaxBurstLength);
if (iscsi_update_param_value(param, tmpbuf))
return -1;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] iscsi-target: make some temporary buffers larger
2013-01-24 7:06 [patch] iscsi-target: make some temporary buffers larger Dan Carpenter
@ 2013-01-29 18:56 ` Nicholas A. Bellinger
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2013-01-29 18:56 UTC (permalink / raw)
To: kernel-janitors
Hi Dan,
On Thu, 2013-01-24 at 10:06 +0300, Dan Carpenter wrote:
> My static checker complains because we use sprintf() to print some
> unsigned ints into 10 byte buffers. In theory unsigned ints can take 10
> characters and we need another for the terminator.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Applied to target-pending/for-next, and apologies for the delay.
Thank you,
--nab
> diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
> index d891642..ca2be40 100644
> --- a/drivers/target/iscsi/iscsi_target_parameters.c
> +++ b/drivers/target/iscsi/iscsi_target_parameters.c
> @@ -1095,11 +1095,11 @@ static int iscsi_check_acceptor_state(struct iscsi_param *param, char *value,
> SET_PSTATE_REPLY_OPTIONAL(param);
> }
> } else if (IS_TYPE_NUMBER(param)) {
> - char *tmpptr, buf[10];
> + char *tmpptr, buf[11];
> u32 acceptor_value = simple_strtoul(param->value, &tmpptr, 0);
> u32 proposer_value = simple_strtoul(value, &tmpptr, 0);
>
> - memset(buf, 0, 10);
> + memset(buf, 0, sizeof(buf));
>
> if (!strcmp(param->name, MAXCONNECTIONS) ||
> !strcmp(param->name, MAXBURSTLENGTH) ||
> @@ -1503,8 +1503,8 @@ static int iscsi_enforce_integrity_rules(
> FirstBurstLength = simple_strtoul(param->value,
> &tmpptr, 0);
> if (FirstBurstLength > MaxBurstLength) {
> - char tmpbuf[10];
> - memset(tmpbuf, 0, 10);
> + char tmpbuf[11];
> + memset(tmpbuf, 0, sizeof(tmpbuf));
> sprintf(tmpbuf, "%u", MaxBurstLength);
> if (iscsi_update_param_value(param, tmpbuf))
> return -1;
> --
> To unsubscribe from this list: send the line "unsubscribe target-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-29 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 7:06 [patch] iscsi-target: make some temporary buffers larger Dan Carpenter
2013-01-29 18:56 ` Nicholas A. Bellinger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.