* [PATCH] [patch]libtirpc: check the makefd_xprt return value
@ 2015-07-09 13:59 ditang chen
2015-07-13 14:27 ` Chuck Lever
2015-07-13 14:37 ` Steve Dickson
0 siblings, 2 replies; 3+ messages in thread
From: ditang chen @ 2015-07-09 13:59 UTC (permalink / raw)
To: steved; +Cc: linux-nfs
xprt may return NULL, so check the return value is necessary.
Signed-off-by: Ditang Chen <ditang.c@gmail.com>
---
src/svc_vc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/svc_vc.c b/src/svc_vc.c
index 9824631..f864951 100644
--- a/src/svc_vc.c
+++ b/src/svc_vc.c
@@ -337,6 +337,8 @@ again:
*/
newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
+ if (!newxprt)
+ return (FALSE);
if (!__rpc_set_netbuf(&newxprt->xp_rtaddr, &addr, len))
return (FALSE);
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [patch]libtirpc: check the makefd_xprt return value
2015-07-09 13:59 [PATCH] [patch]libtirpc: check the makefd_xprt return value ditang chen
@ 2015-07-13 14:27 ` Chuck Lever
2015-07-13 14:37 ` Steve Dickson
1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2015-07-13 14:27 UTC (permalink / raw)
To: ditang chen; +Cc: Steve Dickson, Linux NFS Mailing List
> On Jul 9, 2015, at 9:59 AM, ditang chen <ditang.c@gmail.com> wrote:
>
> xprt may return NULL, so check the return value is necessary.
This would only happen if the malloc() calls in makefd_xprt() failed,
which I think would be exceptionally rare?
Otherwise, this change adds reasonable defensive coding.
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
> Signed-off-by: Ditang Chen <ditang.c@gmail.com>
> ---
> src/svc_vc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/svc_vc.c b/src/svc_vc.c
> index 9824631..f864951 100644
> --- a/src/svc_vc.c
> +++ b/src/svc_vc.c
> @@ -337,6 +337,8 @@ again:
> */
>
> newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
> + if (!newxprt)
> + return (FALSE);
>
> if (!__rpc_set_netbuf(&newxprt->xp_rtaddr, &addr, len))
> return (FALSE);
> --
> 1.9.3
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
chucklever@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [patch]libtirpc: check the makefd_xprt return value
2015-07-09 13:59 [PATCH] [patch]libtirpc: check the makefd_xprt return value ditang chen
2015-07-13 14:27 ` Chuck Lever
@ 2015-07-13 14:37 ` Steve Dickson
1 sibling, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2015-07-13 14:37 UTC (permalink / raw)
To: ditang chen; +Cc: linux-nfs
On 07/09/2015 09:59 AM, ditang chen wrote:
> xprt may return NULL, so check the return value is necessary.
>
> Signed-off-by: Ditang Chen <ditang.c@gmail.com>
Committed... Thanks!
steved.
> ---
> src/svc_vc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/svc_vc.c b/src/svc_vc.c
> index 9824631..f864951 100644
> --- a/src/svc_vc.c
> +++ b/src/svc_vc.c
> @@ -337,6 +337,8 @@ again:
> */
>
> newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
> + if (!newxprt)
> + return (FALSE);
>
> if (!__rpc_set_netbuf(&newxprt->xp_rtaddr, &addr, len))
> return (FALSE);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-13 14:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 13:59 [PATCH] [patch]libtirpc: check the makefd_xprt return value ditang chen
2015-07-13 14:27 ` Chuck Lever
2015-07-13 14:37 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox