From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from movementarian.org ([178.79.150.28]:49792 "EHLO movementarian.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbfANMm6 (ORCPT ); Mon, 14 Jan 2019 07:42:58 -0500 Date: Mon, 14 Jan 2019 12:42:57 +0000 From: John Levon Subject: Re: Odd smatch issue? Message-ID: <20190114124257.GA12158@movementarian.org> References: <20190111123241.GA11408@movementarian.org> <20190114101804.GA4482@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190114101804.GA4482@kadam> Sender: smatch-owner@vger.kernel.org List-ID: To: Dan Carpenter Cc: smatch@vger.kernel.org On Mon, Jan 14, 2019 at 01:18:04PM +0300, Dan Carpenter wrote: > > static long > > lx_cap_update_priv(void) > > { > > const int lx_cap_mapping[4] = { 0, 0, 0 }; > > int i = 63; > > /* enabling the below line disables the warning */ > > //int cap_set = i == 0; > > lx_cap_mapping[i]; > > } > > > > Thanks John, > > I am testing this patch: > > [PATCH] extra: preserve hard_max after comparisons to zero Thanks for taking a look. Unfortunately this still doesn't seem to cover the original case which the above was boiled down from. This does: 76 #define LX_CAP_CAPISSET(id, cap) \ 77 (((id < 32) && (((0x1 << id) & cap[0]) != 0)) || \ 78 ((id >= 32) && (((0x1 << (id - 32) & cap[1]) != 0)))) 221 for (i = 0; i <= LX_CAP_MAX_CHECK; i++) { 222 cap_set = LX_CAP_CAPISSET(i, cap); 223 if (lx_cap_mapping[i] == NULL || i > LX_CAP_MAX_VALID) { (The code is bug is on line :223 where we need to reverse the order of the checks.) regards john