]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
net/pxe: fix error condition
authorAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 30 Jan 2015 19:39:11 +0000 (22:39 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 30 Jan 2015 19:39:11 +0000 (22:39 +0300)
Test return value of grub_netbuff_reserve(), buf itself cannot be
NULL here.

Found by: Coverity scan.

grub-core/net/drivers/i386/pc/pxe.c

index e8c0b22e29403aac46cb956e6d732718e584868d..3f4152d036c949a7a5dc094c66368098ef4d3ae3 100644 (file)
@@ -218,8 +218,7 @@ grub_pxe_recv (struct grub_net_card *dev __attribute__ ((unused)))
     return NULL;
   /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
      by 4. So that IP header is aligned on 4 bytes. */
-  grub_netbuff_reserve (buf, 2);
-  if (!buf)
+  if (grub_netbuff_reserve (buf, 2))
     {
       grub_netbuff_free (buf);
       return NULL;