mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
tools/nolibc: properly align dirent buffer
As byte buffer is overlaid with a 'struct dirent64'.
it has to satisfy the structs alignment requirements.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Fixes: 665fa8dea9 ("tools/nolibc: add support for directory access")
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250419-nolibc-ubsan-v2-4-060b8a016917@weissschuh.net
This commit is contained in:
parent
9fca5554af
commit
0e75768ba2
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef _NOLIBC_DIRENT_H
|
||||
#define _NOLIBC_DIRENT_H
|
||||
|
||||
#include "compiler.h"
|
||||
#include "stdint.h"
|
||||
#include "types.h"
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ int closedir(DIR *dirp)
|
|||
static __attribute__((unused))
|
||||
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
|
||||
{
|
||||
char buf[sizeof(struct linux_dirent64) + NAME_MAX + 1];
|
||||
char buf[sizeof(struct linux_dirent64) + NAME_MAX + 1] __nolibc_aligned_as(struct linux_dirent64);
|
||||
struct linux_dirent64 *ldir = (void *)buf;
|
||||
intptr_t i = (intptr_t)dirp;
|
||||
int fd, ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user