diff mbox series

kernel/audit: Use __struct_size replace __member_size

Message ID 20241203031836.639765-1-15074444048@163.com (mailing list archive)
State Handled Elsewhere
Delegated to: Paul Moore
Headers show
Series kernel/audit: Use __struct_size replace __member_size | expand

Commit Message

李豪杰 Dec. 3, 2024, 3:18 a.m. UTC
From: lihaojie <lihaojie@kylinos.cn>

Size of destnation less of the size to be written will
make future warnings, the size of destnation should be
complete

Signed-off-by: lihaojie <lihaojie@kylinos.cn>
---
 include/linux/fortify-string.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Moore Dec. 3, 2024, 11:18 p.m. UTC | #1
On Mon, Dec 2, 2024 at 10:18 PM <15074444048@163.com> wrote:
>
> From: lihaojie <lihaojie@kylinos.cn>
>
> Size of destnation less of the size to be written will
> make future warnings, the size of destnation should be
> complete
>
> Signed-off-by: lihaojie <lihaojie@kylinos.cn>
> ---
>  include/linux/fortify-string.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This isn't an audit change, this is a FORTIFY_SOURCE change and should
go to the maintainer and mailing list documented in the MAINTAINERS
file (both added to this reply).

> diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
> index 0d99bf11d260..0504b2c8aab7 100644
> --- a/include/linux/fortify-string.h
> +++ b/include/linux/fortify-string.h
> @@ -277,7 +277,7 @@ extern ssize_t __real_strscpy(char *, const char *, size_t) __RENAME(sized_strsc
>  __FORTIFY_INLINE ssize_t sized_strscpy(char * const POS p, const char * const POS q, size_t size)
>  {
>         /* Use string size rather than possible enclosing struct size. */
> -       const size_t p_size = __member_size(p);
> +       const size_t p_size = __struct_size(p);
>         const size_t q_size = __member_size(q);
>         size_t len;
>
> --
> 2.25.1
diff mbox series

Patch

diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index 0d99bf11d260..0504b2c8aab7 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -277,7 +277,7 @@  extern ssize_t __real_strscpy(char *, const char *, size_t) __RENAME(sized_strsc
 __FORTIFY_INLINE ssize_t sized_strscpy(char * const POS p, const char * const POS q, size_t size)
 {
 	/* Use string size rather than possible enclosing struct size. */
-	const size_t p_size = __member_size(p);
+	const size_t p_size = __struct_size(p);
 	const size_t q_size = __member_size(q);
 	size_t len;