From mboxrd@z Thu Jan 1 00:00:00 1970 From: me@tobin.cc (Tobin C. Harding) Date: Wed, 8 Mar 2017 10:20:37 +1100 Subject: sizeof Message-ID: <20170307232037.GA5349@eros> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Question relating to the validity/usefulness of patching calls to sizeof. >>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) ---