On Wed, Sep 20, 2023 at 11:16:21PM +0200, Martin Uecker wrote: > I meant something else: Why wasn't an unsigned type > used in the first place? If all "counter" variables were > signed and all "modulo" variables unsigned, one could already > diagnose overflow reliably. > > I was trying to understand if there are generally > valid reasons for using unsigned integers for "counters". > or whether this is just a historical mistake in the > kernel.
There isn't a common guideline in the kernel coding style for this, so it's mostly arbitrary. :( > (and thank you for your explanations) Sure thing! Thanks for your (and everyone's) help clarifying this whole area. :) -Kees -- Kees Cook