KernelTrap: Debating Coding Style | Linux Today

KernelTrap: Debating Coding Style

Written By
Web Webster
Web Webster
Sep 23, 2005

“The Linux kernel coding style document was recently upgraded to
say ‘the preferred form for passing a size of a struct is the
following: p = kmalloc(sizeof(*p), ...);.’ Russell
King disagreed with this suggestion, listing several reasons it was
problematic. He was quickly joined by others including Al Viro,
Robert Love, and Alan Cox, who agreed and added additional reasons
why this coding convention could be problematic, suggesting instead
to use ‘p = kmalloc(sizeof(struct foo), ...).’ The
reasons cited included the difficulty in grepping for such
allocations and initializations, confusion over the fact the
sizeof(*p) is the size of for example a void
*, not the full space for the object allocated and
overall readability…”

Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.