Re: [PATCH v2] mm/shmem.c: check the return value of mpol_to_str()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Sep 2013, Chen Gang wrote:

> 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).
> 

What on earth are we talking about in this thread?

Rename mpol_to_str() to __mpol_to_str().  Make a static inline function in 
mempolicy.h named mpol_to_str().  That function does BUILD_BUG_ON(maxlen < 
64) and then calls __mpol_to_str().

Modify __mpol_to_str() to store "unknown" when mpol->mode does not match 
any known MPOL_* constant.

Both functions can now return void.

This is like a ten line diff.  Seriously.

--
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>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]