On 09/14/2013 10:51 AM, KOSAKI Motohiro wrote: > On 9/13/2013 5:12 PM, David Rientjes wrote: >> On Wed, 11 Sep 2013, KOSAKI Motohiro wrote: >> >>> At least, currently mpol_to_str() already have following assertion. I mean, >>> the code assume every developer know maximum length of mempolicy. I have no >>> seen any reason to bring addional complication to shmem area. >>> >>> >>> /* >>> * Sanity check: room for longest mode, flag and some nodes >>> */ >>> VM_BUG_ON(maxlen < strlen("interleave") + strlen("relative") + 16); >>> >> >> No need to make it a runtime error, the value passed as maxlen is a >> constant, as is the use of sizeof(buffer), so the value is known at >> compile-time. You can make this a BUILD_BUG_ON() if you are creative. > > Making compile time error brings us another complication. I'd like to > keep just one line assertion. > Hmm... I am not quite sure: a C compiler is clever enough to know about that. At least, for ANSI C definition, the C compiler has no duty to know about that. And it is not for an optimization, either, so I guess the C compiler has no enought interests to support this features (know about that). Thanks. -- Chen Gang -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>