Re: [PATCH] [patch]libtirpc: check the makefd_xprt return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Jul 9, 2015, at 9:59 AM, ditang chen <ditang.c@xxxxxxxxx> 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@xxxxxxxxxx>


> Signed-off-by: Ditang Chen <ditang.c@xxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chucklever@xxxxxxxxx



--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux