From patchwork Mon Jul 31 04:26:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Kinard X-Patchwork-Id: 9870829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB50260375 for ; Mon, 31 Jul 2017 04:27:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA2AD284B2 for ; Mon, 31 Jul 2017 04:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBF2B28500; Mon, 31 Jul 2017 04:27:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ACB6284B2 for ; Mon, 31 Jul 2017 04:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750881AbdGaE1C (ORCPT ); Mon, 31 Jul 2017 00:27:02 -0400 Received: from resqmta-ch2-09v.sys.comcast.net ([69.252.207.41]:57278 "EHLO resqmta-ch2-09v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750810AbdGaE1B (ORCPT ); Mon, 31 Jul 2017 00:27:01 -0400 Received: from resomta-ch2-11v.sys.comcast.net ([69.252.207.107]) by resqmta-ch2-09v.sys.comcast.net with ESMTP id c2IAdaPCvDG8Zc2IHd4dYM; Mon, 31 Jul 2017 04:27:01 +0000 Received: from [192.168.1.13] ([73.201.189.102]) by resomta-ch2-11v.sys.comcast.net with SMTP id c2IFdfhnBVh3hc2IGdzsdh; Mon, 31 Jul 2017 04:27:01 +0000 To: libtirpc-devel@lists.sourceforge.net Cc: linux-nfs@vger.kernel.org, Joshua Kinard From: Joshua Kinard Subject: [PATCH] Replace bcopy() calls with equivalent memmove() calls Message-ID: Date: Mon, 31 Jul 2017 00:26:58 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-US X-CMAE-Envelope: MS4wfAyv+L2I8bRsDn83Pv55wYkSFEnuBjWV5SrorKvx2HklrtB71s80NTyxsfqgHxKN4ov+Vcz+FvVBJqLIv8zgNin3mMXhmMZ7lkcvobYmYrKf54jKk5CH xSuCPRRo9hmkBZFccpY9Vljjg4wbcaZTgvuJu4ymvChMO1vCml9KpNDPCY7xbG8NEfMJC92K/WDeuBZL1kHEPrRMSaa6kQpxoENjQcgaXMsCH4B7M0Mi6ZUo O8MA3N4epCKF+8BW+IvlGg== Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As annotated in the bcopy(3) man page, bcopy() was marked as LEGACY in POSIX.1-2001 and removed in POSIX.1-2008, and should be replaced with either memcpy() or memmove() calls to copy bytes from one memory region to another. The attached patch replaces all bcopy() calls in libtirpc with equivalent memmove() calls. Signed-off-by: Joshua Kinard Reviewed-by: Chuck Lever --- src/auth_time.c | 2 +- src/crypt_client.c | 8 ++++---- src/svc_auth_des.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) -- 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 diff --git a/src/auth_time.c b/src/auth_time.c index 210d251..5426902 100644 --- a/src/auth_time.c +++ b/src/auth_time.c @@ -104,7 +104,7 @@ static int uaddr_to_sockaddr(uaddr, sin) p_bytes[1] = (unsigned char)a[5] & 0x000000FF; sin->sin_family = AF_INET; /* always */ - bcopy((char *)&p_bytes, (char *)&sin->sin_port, 2); + memmove((char *)&sin->sin_port, (char *)&p_bytes, 2); return (0); } diff --git a/src/crypt_client.c b/src/crypt_client.c index f393926..b8c5767 100644 --- a/src/crypt_client.c +++ b/src/crypt_client.c @@ -75,8 +75,8 @@ _des_crypt_call(buf, len, dparms) des_crypt_1_arg.desbuf.desbuf_val = buf; des_crypt_1_arg.des_dir = dparms->des_dir; des_crypt_1_arg.des_mode = dparms->des_mode; - bcopy(dparms->des_ivec, des_crypt_1_arg.des_ivec, 8); - bcopy(dparms->des_key, des_crypt_1_arg.des_key, 8); + memmove(des_crypt_1_arg.des_ivec, dparms->des_ivec, 8); + memmove(des_crypt_1_arg.des_key, dparms->des_key, 8); result_1 = des_crypt_1(&des_crypt_1_arg, clnt); if (result_1 == (desresp *) NULL) { @@ -88,8 +88,8 @@ _des_crypt_call(buf, len, dparms) if (result_1->stat == DESERR_NONE || result_1->stat == DESERR_NOHWDEVICE) { - bcopy(result_1->desbuf.desbuf_val, buf, len); - bcopy(result_1->des_ivec, dparms->des_ivec, 8); + memmove(buf, result_1->desbuf.desbuf_val, len); + memmove(dparms->des_ivec, result_1->des_ivec, 8); } clnt_freeres(clnt, (xdrproc_t)xdr_desresp, result_1); diff --git a/src/svc_auth_des.c b/src/svc_auth_des.c index 64a7682..5813c5a 100644 --- a/src/svc_auth_des.c +++ b/src/svc_auth_des.c @@ -145,7 +145,7 @@ _svcauth_des(rqst, msg) return (AUTH_BADCRED); } cred->adc_fullname.name = area->area_netname; - bcopy((char *)ixdr, cred->adc_fullname.name, + memmove(cred->adc_fullname.name, (char *)ixdr, (u_int)namelen); cred->adc_fullname.name[namelen] = 0; ixdr += (RNDUP(namelen) / BYTES_PER_XDR_UNIT);