Re: [PATCH 1/3] netlink: use the macro min(x,y) provided by instead
From: Denis Cheng <[EMAIL PROTECTED]> Date: Sun, 2 Sep 2007 03:45:57 +0800 > Signed-off-by: Denis Cheng <[EMAIL PROTECTED]> Applied to net-2.6.24, thanks. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] netlink: use the macro min(x,y) provided by instead
On 9/2/07, David Newall <[EMAIL PROTECTED]> wrote: > Denis Cheng wrote > > + order = get_bitmask_order(min(max, (unsigned long)UINT_MAX)) - 1; > > > > Why doesn't this clash with the max define, also in linux/kernel.h? They indeed don't clash, the cpp included by gcc is intelligent enough, it know the function-style definition of max in kernel.h, that's different from the auto variable max here, so they don't clash with each other, But I think the variable name "max" here is ambiguous, I changed it to "limit", see my following patch [PATCH 2/3]. -- Denis Cheng - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] netlink: use the macro min(x,y) provided by instead
Signed-off-by: Denis Cheng <[EMAIL PROTECTED]> --- net/netlink/af_netlink.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 5681ce3..8bb14e3 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1905,7 +1905,7 @@ static int __init netlink_proto_init(void) order = get_bitmask_order(max) - 1 + PAGE_SHIFT; max = (1UL << order) / sizeof(struct hlist_head); - order = get_bitmask_order(max > UINT_MAX ? UINT_MAX : max) - 1; + order = get_bitmask_order(min(max, (unsigned long)UINT_MAX)) - 1; for (i = 0; i < MAX_LINKS; i++) { struct nl_pid_hash *hash = _table[i].hash; -- 1.5.3.rc7 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/