sizeof
Question relating to the validity/usefulness of patching calls to sizeof.
Quoted 1 line
From
Documentation/process/coding-style.rst
The preferred form for passing a size of a struct is the following:
.. code-block:: c
p = kmalloc(sizeof(*p), ...);
The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed
but the corresponding sizeof that is passed to a memory allocator is not.Is the distinction between
Question:
Is a the following a valid/useful patch or just code churn
diff--
- sizeof(struct foo)
+ sizeof(*fp)
---
Quoted 17 lines · Tobin C. Harding
Question relating to the validity/usefulness of patching calls to sizeof.
Quoted 1 line
From
Documentation/process/coding-style.rstThe preferred form for passing a size of a struct is the following:
.. code-block:: c
p = kmalloc(sizeof(*p), ...);The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed
but the corresponding sizeof that is passed to a memory allocator is not.Is the distinction between
Quoted 10 lines
Question:
Is a the following a valid/useful patch or just code churn
diff--
- sizeof(struct foo)
+sizeof(*fp)
That should depend on consistency of convention in whole file. If there are multiple instance of this in same file(or whole module), it might not make sense to change them all.
Quoted 7 lines
---
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Signature · 6 lines
Thank you Warm Regards Anuz -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170308/74475c41/attachment-0001.html