All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] slirp: Remove superfluous memset() calls from the TFTP code
@ 2016-06-27 10:41 Thomas Huth
  2016-06-27 19:49 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2016-06-27 10:41 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel; +Cc: Jan Kiszka, qemu-trivial

Commit fad7fb9ccd8013ea03  ("Add IPv6 support to the TFTP code")
refactored some common code for preparing the mbuf into a new
function called tftp_prep_mbuf_data(). One part of this common
code is to do a "memset(m->m_data, 0, m->m_size);" for the related
buffer first. However, at two spots, the memset() was not removed
from the calling function, so it currently done twice in these code
paths. Thus let's delete these superfluous memsets in the calling
functions now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 slirp/tftp.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/slirp/tftp.c b/slirp/tftp.c
index 12b5ff6..3673402 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -208,8 +208,6 @@ static void tftp_send_error(struct tftp_session *spt,
     goto out;
   }
 
-  memset(m->m_data, 0, m->m_size);
-
   tp = tftp_prep_mbuf_data(spt, m);
 
   tp->tp_op = htons(TFTP_ERROR);
@@ -237,8 +235,6 @@ static void tftp_send_next_block(struct tftp_session *spt,
     return;
   }
 
-  memset(m->m_data, 0, m->m_size);
-
   tp = tftp_prep_mbuf_data(spt, m);
 
   tp->tp_op = htons(TFTP_DATA);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] slirp: Remove superfluous memset() calls from the TFTP code
  2016-06-27 10:41 [Qemu-devel] [PATCH] slirp: Remove superfluous memset() calls from the TFTP code Thomas Huth
@ 2016-06-27 19:49 ` Samuel Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2016-06-27 19:49 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, Jan Kiszka, qemu-trivial

Thomas Huth, on Mon 27 Jun 2016 12:41:36 +0200, wrote:
> Commit fad7fb9ccd8013ea03  ("Add IPv6 support to the TFTP code")
> refactored some common code for preparing the mbuf into a new
> function called tftp_prep_mbuf_data(). One part of this common
> code is to do a "memset(m->m_data, 0, m->m_size);" for the related
> buffer first. However, at two spots, the memset() was not removed
> from the calling function, so it currently done twice in these code
> paths. Thus let's delete these superfluous memsets in the calling
> functions now.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks!

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  slirp/tftp.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/slirp/tftp.c b/slirp/tftp.c
> index 12b5ff6..3673402 100644
> --- a/slirp/tftp.c
> +++ b/slirp/tftp.c
> @@ -208,8 +208,6 @@ static void tftp_send_error(struct tftp_session *spt,
>      goto out;
>    }
>  
> -  memset(m->m_data, 0, m->m_size);
> -
>    tp = tftp_prep_mbuf_data(spt, m);
>  
>    tp->tp_op = htons(TFTP_ERROR);
> @@ -237,8 +235,6 @@ static void tftp_send_next_block(struct tftp_session *spt,
>      return;
>    }
>  
> -  memset(m->m_data, 0, m->m_size);
> -
>    tp = tftp_prep_mbuf_data(spt, m);
>  
>    tp->tp_op = htons(TFTP_DATA);
> -- 
> 1.8.3.1
> 

-- 
Samuel
<macavity> bash: ls: Computer bought the farm
<macavity> THAT frightens ppl! :P
<macavity> id rather see: "bash: ls: Initialization of googol(AWAX)
        disengaged in HYPER32/64 mode due to faulty page request at
        AX:12A34F84B"
<macavity> at least that would give me the feeling that the
        *programmers* knows what is going on :P
(lovely Hurd...)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-27 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 10:41 [Qemu-devel] [PATCH] slirp: Remove superfluous memset() calls from the TFTP code Thomas Huth
2016-06-27 19:49 ` Samuel Thibault

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.