From nobody Thu Feb 16 11:56:42 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHYMG2xRmz3q5tG; Thu, 16 Feb 2023 11:56:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHYMG2GWjz4Cr1; Thu, 16 Feb 2023 11:56:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676548602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YfWx/oc9Wnkg/gtiyUIgaJeRxxobb2Hr/to1J2C5Zs8=; b=tiRmyA0hmio7ludgMoFCh462JWHtw1m8+0KAcASkwDKxotGgG21FfFa4fZ7HMHWhSY5m+Z cd37SOA6DLitYO6eGF7aBPa+FPS5NJ563tOvd9kbiolgf/5GWKuEA8GqGW/4yXTxy3Hz+7 1oIf3vjorjPJ5z4o2SotvQiTWDT4tnLPp0iiA/dTN1+rsJqSw5wUAMxabeTHM/uz4Q+k/T yglpsDTW5xzFXwnVaQvnX5OzYb3PPrFSEHpUna15HwYHQNOmQ1pd/s7le1IX2zBE2XR1sK 3FafXh8rXLoOcuY/fJS5bx+mb+FcQuEDsvkmJnnsTD1KogDEVBHRC4Mx1N0OFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676548602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YfWx/oc9Wnkg/gtiyUIgaJeRxxobb2Hr/to1J2C5Zs8=; b=ObHGS40SptZRCGWxvlZ5NcJFDUhZodvUe05nci+x6ibmNdx+29xhyTX3TbhwMK25mHiq8f 1VIbRZ20NQOPzL7Bw/qAuI8mDLuLsU+47upU5zDoHTy4dngcD4ot4CeaALOB7HMakRei9G 9MCgCJA1k/i6dBKO7hva6/VrzbZpUOND36Jf4N80ckGDDcq9sgc2a14xnlnlhcPrF7gF82 UnZZ0KKpaWhX7CJU2psajDlRTrOuQd8OKMRB95ooD/oAIWRE23JD0E/Kdcdyml3UfQSwl3 QMpKqg1ilFFBpmDkzoq7MB3I+/D4Z+azot6n4dk1u9epx81qAI99fOk6N+OSdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676548602; a=rsa-sha256; cv=none; b=eEcKnXAKjMsAE1dHt5X1VDEdZGmMYWXAfFSPgnw+tuMe9soXKFc6mYAMjiVSRexHs4zRQe 2s7HZapQSwqXF8/Fw6o/gFF5QDSOK+uFATWdTFqscFe5L4PnJlCWJpH2o52znQXWPUxqyf y7wbhYzdKy5EaGRWAX61EhbPuquXIU0hlqDChcHYBPmaCPkI9bHOHe9Y7uRShXIg/FBtvY sLjeNTyoHM7VpeLHhhJYx77XzHOX9ngtdSj/U9BYq5h/W3Qf2MGfkkjIx7CqwccyUx9J4d +eXkI3bNY2/Sf+2Zm7zhjC+pFbQZbtdRH2amptg7DMQRG/skC/WpplQ9sj7qzA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PHYMG1BXsz12tl; Thu, 16 Feb 2023 11:56:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31GBugWM056580; Thu, 16 Feb 2023 11:56:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31GBugxw056579; Thu, 16 Feb 2023 11:56:42 GMT (envelope-from git) Date: Thu, 16 Feb 2023 11:56:42 GMT Message-Id: <202302161156.31GBugxw056579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 9752a6c97383 - stable/13 - linuxkpi: Add `strscpy_pad()` to List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9752a6c97383d2b65a1e9f363e9ea6a7308c60dd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9752a6c97383d2b65a1e9f363e9ea6a7308c60dd commit 9752a6c97383d2b65a1e9f363e9ea6a7308c60dd Author: Jean-Sébastien Pédron AuthorDate: 2023-02-14 23:46:13 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-02-16 11:55:22 +0000 linuxkpi: Add `strscpy_pad()` to It's the same as `strscpy()` except that it fills the rest of the destination buffer with zeroes if the source buffer is shorter. Reviewed by: manu Approved by: manu (cherry picked from commit b1a9e570fe2da0a43c41327d7ce21b27bf8257b8) --- sys/compat/linuxkpi/common/include/linux/string.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 65422cac629c..20c3729aaf12 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -207,6 +207,15 @@ strscpy(char* dst, const char* src, size_t len) return (-E2BIG); } +static inline ssize_t +strscpy_pad(char* dst, const char* src, size_t len) +{ + + bzero(dst, len); + + return (strscpy(dst, src, len)); +} + static inline void * memset32(uint32_t *b, uint32_t c, size_t len) {