Module Name: src Committed By: drochner Date: Tue Jan 10 20:05:37 UTC 2012
Modified Files: src/sys/netinet6: ip6_output.c Log Message: remove conditionals which can't succeed, and also shouldn't because one would get a kernel NULL dereference immediately To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/sys/netinet6/ip6_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/ip6_output.c diff -u src/sys/netinet6/ip6_output.c:1.143 src/sys/netinet6/ip6_output.c:1.144 --- src/sys/netinet6/ip6_output.c:1.143 Tue Jan 10 20:01:56 2012 +++ src/sys/netinet6/ip6_output.c Tue Jan 10 20:05:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_output.c,v 1.143 2012/01/10 20:01:56 drochner Exp $ */ +/* $NetBSD: ip6_output.c,v 1.144 2012/01/10 20:05:37 drochner Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.143 2012/01/10 20:01:56 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.144 2012/01/10 20:05:37 drochner Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -2323,7 +2323,7 @@ do { \ if (src->type) { \ int hlen = (((struct ip6_ext *)src->type)->ip6e_len + 1) << 3;\ dst->type = malloc(hlen, M_IP6OPT, canwait); \ - if (dst->type == NULL && canwait == M_NOWAIT) \ + if (dst->type == NULL) \ goto bad; \ memcpy(dst->type, src->type, hlen); \ } \ @@ -2338,14 +2338,14 @@ copypktopts(struct ip6_pktopts *dst, str if (src->ip6po_pktinfo) { dst->ip6po_pktinfo = malloc(sizeof(*dst->ip6po_pktinfo), M_IP6OPT, canwait); - if (dst->ip6po_pktinfo == NULL && canwait == M_NOWAIT) + if (dst->ip6po_pktinfo == NULL) goto bad; *dst->ip6po_pktinfo = *src->ip6po_pktinfo; } if (src->ip6po_nexthop) { dst->ip6po_nexthop = malloc(src->ip6po_nexthop->sa_len, M_IP6OPT, canwait); - if (dst->ip6po_nexthop == NULL && canwait == M_NOWAIT) + if (dst->ip6po_nexthop == NULL) goto bad; memcpy(dst->ip6po_nexthop, src->ip6po_nexthop, src->ip6po_nexthop->sa_len); @@ -2375,7 +2375,7 @@ ip6_copypktopts(struct ip6_pktopts *src, struct ip6_pktopts *dst; dst = malloc(sizeof(*dst), M_IP6OPT, canwait); - if (dst == NULL && canwait == M_NOWAIT) + if (dst == NULL) return (NULL); ip6_initpktopts(dst);