From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932813AbcKMHby (ORCPT ); Sun, 13 Nov 2016 02:31:54 -0500 Received: from s3.sipsolutions.net ([5.9.151.49]:46066 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932268AbcKMHbx (ORCPT ); Sun, 13 Nov 2016 02:31:53 -0500 Message-ID: <1479022304.4897.0.camel@sipsolutions.net> Subject: Re: [PATCH] genetlink: fix unsigned int comparison with less than zero From: Johannes Berg To: Cong Wang Cc: Colin King , "David S . Miller" , pravin shelar , Wei Yongjun , Florian Westphal , Tycho Andersen , Tom Herbert , Linux Kernel Network Developers , LKML Date: Sun, 13 Nov 2016 08:31:44 +0100 In-Reply-To: (sfid-20161113_062527_710881_19064851) References: <20161110155758.26996-1-colin.king@canonical.com> <1478986636.4226.4.camel@sipsolutions.net> (sfid-20161113_062527_710881_19064851) Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > I suppose it could be, since family IDs are allocated in a 16-bit > > range > > anyway. But family IDs can also never actually be negative, so > > having > > an unsigned int in the struct makes sense too. > > All idr_* API's accept int, rather than unsigned int. This is my > point. Sure, but that's an internal implementation detail. The struct genl_family is also an external API towards its users, and there negative numbers make no sense whatsoever. johannes