Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of the element_count annotation #11

Open
jvoisin opened this issue Jul 3, 2023 · 5 comments
Open

Make use of the element_count annotation #11

jvoisin opened this issue Jul 3, 2023 · 5 comments
Assignees
Labels

Comments

@jvoisin jvoisin self-assigned this Jul 3, 2023
@jvoisin jvoisin changed the title Make use of the element_count annotation Make use of the element_count annotation Jul 4, 2023
@nekopsykose
Copy link
Contributor

something i noticed is that for things like e.g. fread

size_t fread(void ptr[restrict .size * .nmemb],
             size_t size, size_t nmemb,
             FILE *restrict stream);

this case is seemingly not supported (can't element_count(size*nmemb) ?)

@nekopsykose
Copy link
Contributor

actually since it's for fams only it's not useful for that anyway

@nekopsykose
Copy link
Contributor

nekopsykose commented Jul 10, 2024

hm, or is it? all the discussion talks about using it for fams, but if it's just a builtin_object_size complement then it should be usable on function args too...

@jvoisin
Copy link
Owner Author

jvoisin commented Jul 10, 2024

Yeah, the current status of element_count is a bit confusing unfortunately. Let's wait until the dust settles and for the Linux kernel to move forward with it :P

@kees
Copy link

kees commented Jul 10, 2024

counted_by only currently works for flexible array members. https://opensource.googleblog.com/2024/07/bounds-checking-flexible-array-members.html
Coming next will be applying it to pointer members and for function arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants