slirp: Remove superfluous memset() calls from the TFTP code
PATCH 1/1 slirp: Remove superfluous memset() calls from the TFTP code
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.
--- slirp/tftp.c | 4 ---- 1 file changed, 4 deletions(-)
slirp/tftp.c +0 -4
@@ -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 );
Signature · 1 line
1.8.3.1
Quoted 10 lines · 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 calledtftp_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, thememset()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 <[email protected]>
Thanks!
Quoted 29 lines
--- slirp/tftp.c | 4 ---- 1 file changed, 4 deletions(-)slirp/tftp.c +0
-4@@ -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 );Signature · 1 line
1.8.3.1
Signature · 9 lines
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...)