Re: [PATCH 08/15] tgtadm: zero out buffer used for requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 09 Jun 2009 18:22:26 +0200
Arne Redlich <arne.redlich@xxxxxxxxxxxxxx> wrote:

> Signed-off-by: Arne Redlich <arne.redlich@xxxxxxxxxxxxxx>
> ---
> We should probably check if valloc actually returned a buffer?

Yeah,


>  usr/tgtadm.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.


> 
> diff --git a/usr/tgtadm.c b/usr/tgtadm.c
> index 671af31..8d9f7e2 100644
> --- a/usr/tgtadm.c
> +++ b/usr/tgtadm.c
> @@ -426,6 +426,7 @@ int main(int argc, char **argv)
>  	char *bstype;
>  	char *user, *password;
>  	char *buf;
> +	size_t bufsz = BUFSIZE + sizeof(struct tgtadm_req);
>  	struct tgtadm_req *req;
>  
>  	op = tid = mode = -1;
> @@ -437,9 +438,8 @@ int main(int argc, char **argv)
>  	name = value = path = targetname = address = targetOps = bstype = NULL;
>  	user = password = NULL;
>  
> -	buf = valloc(BUFSIZE + sizeof(struct tgtadm_req));
> -
> -	memset(buf, 0, sizeof(buf));
> +	buf = valloc(bufsz);
> +	memset(buf, 0, bufsz);
>  	req = (struct tgtadm_req *) buf;
>  
>  	optind = 1;
> -- 
> 1.6.0.4
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stgt" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux