* [PATCH] isofs: Annotate struct SL_component with __counted_by()
@ 2024-08-30 16:49 Thorsten Blum
2024-09-02 13:55 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-08-30 16:49 UTC (permalink / raw)
To: jack, kees, gustavoars
Cc: linux-fsdevel, linux-kernel, linux-hardening, Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member
text to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
fs/isofs/rock.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/isofs/rock.h b/fs/isofs/rock.h
index ee9660e9671c..7755e587f778 100644
--- a/fs/isofs/rock.h
+++ b/fs/isofs/rock.h
@@ -44,7 +44,7 @@ struct RR_PN_s {
struct SL_component {
__u8 flags;
__u8 len;
- __u8 text[];
+ __u8 text[] __counted_by(len);
} __attribute__ ((packed));
struct RR_SL_s {
--
2.46.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] isofs: Annotate struct SL_component with __counted_by()
2024-08-30 16:49 [PATCH] isofs: Annotate struct SL_component with __counted_by() Thorsten Blum
@ 2024-09-02 13:55 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2024-09-02 13:55 UTC (permalink / raw)
To: Thorsten Blum
Cc: jack, kees, gustavoars, linux-fsdevel, linux-kernel,
linux-hardening
On Fri 30-08-24 18:49:03, Thorsten Blum wrote:
> Add the __counted_by compiler attribute to the flexible array member
> text to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> CONFIG_FORTIFY_SOURCE.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Thanks. I've added the patch to my tree.
Honza
> ---
> fs/isofs/rock.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/isofs/rock.h b/fs/isofs/rock.h
> index ee9660e9671c..7755e587f778 100644
> --- a/fs/isofs/rock.h
> +++ b/fs/isofs/rock.h
> @@ -44,7 +44,7 @@ struct RR_PN_s {
> struct SL_component {
> __u8 flags;
> __u8 len;
> - __u8 text[];
> + __u8 text[] __counted_by(len);
> } __attribute__ ((packed));
>
> struct RR_SL_s {
> --
> 2.46.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-02 13:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 16:49 [PATCH] isofs: Annotate struct SL_component with __counted_by() Thorsten Blum
2024-09-02 13:55 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).