All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hajime Tazaki<thehajime@gmail.com>
To: ddiss@suse.de
Cc: tavi.purdila@gmail.com, linux-kernel-library@freelists.org,
	linux-um@lists.infradead.org
Subject: Re: [RFC v3 18/26] lkl tools: add test programs
Date: Thu, 13 Feb 2020 08:05:02 +0900	[thread overview]
Message-ID: <m2mu9nwgo1.wl-thehajime@gmail.com> (raw)
In-Reply-To: <20200212143229.3a557114@suse.de>


On Wed, 12 Feb 2020 22:32:29 +0900,
David Disseldorp wrote:

> Some minor comments on net-test...
> 
> On Wed, 05 Feb 2020 23:46:39 +0900, Hajime Tazaki wrote:
> 
> > +static int lkl_test_icmp(void)
> > +{
> ...
> > +	icmp = malloc(sizeof(struct lkl_icmphdr *));
> 
> I think this should be sizeof(struct lkl_icmphdr)

thanks, I'll fix this.

> ...
> > +	ret = lkl_sys_recv(sock, buf, sizeof(buf), LKL_MSG_DONTWAIT);
> > +	if (ret < 0) {
> > +		lkl_test_logf("recv error (%s)\n", lkl_strerror(ret));
> > +		return TEST_FAILURE;
> > +	}
> > +
> > +	iph = (struct lkl_iphdr *)buf;
> > +	icmp = (struct lkl_icmphdr *)(buf + iph->ihl * 4);
> 
> I realise this is test code, but IMO it still makes sense to do bounds
> checking here, e.g.
> 
>   pkt_len = ret;
>   if (pkt_len < sizeof(struct lkl_iphdr)) {
>           return TEST_FAILURE;
>   }
> 
>   iph = (struct lkl_iphdr *)buf;
>   icmphdr_off = iph->ihl * 4;
>   if (pkt_len < icmphdr_off + sizeof(struct lkl_icmphdr)) {
>           return TEST_FAILURE;
>   }

thanks,  I will fix this too in the next round.

-- Hajime

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


       reply	other threads:[~2020-02-12 23:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200212143229.3a557114@suse.de>
2020-02-12 23:05 ` Hajime Tazaki [this message]
2020-02-05  7:30 [RFC v3 00/26] Unifying LKL into UML Hajime Tazaki
2020-02-05  7:30 ` [RFC v3 18/26] lkl tools: add test programs Hajime Tazaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mu9nwgo1.wl-thehajime@gmail.com \
    --to=thehajime@gmail.com \
    --cc=ddiss@suse.de \
    --cc=linux-kernel-library@freelists.org \
    --cc=linux-um@lists.infradead.org \
    --cc=tavi.purdila@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.