Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 2026 21:43:11 +0000
From:      Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 12d558d4ec73 - stable/15 - linuxkpi: Add `memdup_array_user()`
Message-ID:  <69f27b6f.194b7.43208d84@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=12d558d4ec7363255183b65cdfaceaf2490d202c

commit 12d558d4ec7363255183b65cdfaceaf2490d202c
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-04-21 00:01:11 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-29 21:04:18 +0000

    linuxkpi: Add `memdup_array_user()`
    
    The amdgpu DRM driver started this in Linux 6.12.x.
    
    Reviewed by:    bz
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 5dfbc6593cdacd5b4e4939e09d595b3a9c8e47da)
---
 sys/compat/linuxkpi/common/include/linux/string.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index ba6549804edc..b195dcc8fe9b 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -88,6 +88,17 @@ memdup_user_nul(const void *ptr, size_t len)
 	return (retval);
 }
 
+static inline void *
+memdup_array_user(const void *src, size_t n, size_t size)
+{
+	size_t len;
+
+	if (check_mul_overflow(n, size, &len))
+		return (ERR_PTR(-EOVERFLOW));
+
+	return (memdup_user(src, len));
+}
+
 static inline void *
 kmemdup(const void *src, size_t len, gfp_t gfp)
 {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f27b6f.194b7.43208d84>