lkml.org 
[lkml]   [2013]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] memblock: add assertion for zero allocation size
On Friday 22 February 2013 01:06 AM, Tejun Heo wrote:
> On Fri, Feb 22, 2013 at 01:03:41AM +0530, Vineet Gupta wrote:
>> Where - you mean if user passes 0, just make it 1. Nah - it's better to complain
>> and get the call site fixed !
>>
>>> or BUG_ON(!align) instead?
>> That could be done too but you would also need BUG_ON(!size) - to catch another
>> API abuse.
>> BUG_ON(!size) however catches both the cases.
> How about "if (WARN_ON(!align)) align = __alignof__(long long);"?
> Early BUG_ON()s can be painful to debug depending on setup.

Totally agree - been there - seen that :-)
Also for caller passing zero, the panic will force the caller to fix it.
I'll respin the patch.

Thx,
-Vineet



\
 
 \ /
  Last update: 2013-02-21 21:42    [W:0.066 / U:0.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site