Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5075654pxv; Wed, 28 Jul 2021 02:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx96A/pc73cOW2aTeGaXnXsw8ThcTyYCSMKK0/UeVZyKSfh5Ii9p8kv0T9pgVmN4Es0K9CM X-Received: by 2002:a17:906:888e:: with SMTP id ak14mr9037380ejc.134.1627464481312; Wed, 28 Jul 2021 02:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627464481; cv=none; d=google.com; s=arc-20160816; b=Tw/kwcTOCXaBh8ka7hqWdAzJfI0ZdaWMgX84Bwm/ctwhYaGrYwAsjxhv9wBhGIARN8 zAISteR3l6A5iJ4/qvbCd82Xp9h2xjz3Ft0bI11htr6d2G8kBqPS/5ZWwO/8kVB7Y7hv zAdOAWymKsBoDofDMMKvKk8Rka6lQP0R3vIpsWo7ccsCUpX4yTVaWO33LBxWJokWoPzz ODsD2BWt9NiudLwToHqQ3nYmTInkovUI/bYtbg4ipcC7Buv9Lr3YBuMOXNMHcSlECs9y BDfrm+OOmnBI8BccDrIEJsSNyL6eKwj44i7OSJM5quJf4H76pzmGsvusb8dsaAAARVC/ H3Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=5viwOi0Ex8EMpcyt5fZAmdaE8zZE3JenBgOEfHjTO8U=; b=w2BY5IFUJlSq+I0y1of3vmReHTvC0si7SsRpMxB/Nv2gJzQJJrcYeZRKyuosJ8SzNV sr1DPmkfsMyMyatxJEoAtxIGCcwS5p6eddiPPtJs1cV3pLTssRWt/ehX4r9Y17QB5eD/ JxWFVeFU1rcmXDind5nOl6k43qkhC/hSn0BlfuUKwEiuh+bJAK9KoAIzJ3Jy1L7H6c5Q RtnkN5OedviGJfP17qzobLwek/Gjejkrakdn344rbvpXbJsPucIuAcMM6CHNECMKuc4L HAjcMqW74yqIo6pUps9axUHrtCMgn6Dq5OK4liiBGUg8fl5e96Sss9nlxGL2P/XY9XNV GBSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=s2tZ7LKm; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si2283565ejr.352.2021.07.28.02.27.33; Wed, 28 Jul 2021 02:28:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=s2tZ7LKm; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235452AbhG1J0L (ORCPT + 99 others); Wed, 28 Jul 2021 05:26:11 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:46536 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231482AbhG1J0L (ORCPT ); Wed, 28 Jul 2021 05:26:11 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9CE3A222EA; Wed, 28 Jul 2021 09:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1627464368; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5viwOi0Ex8EMpcyt5fZAmdaE8zZE3JenBgOEfHjTO8U=; b=s2tZ7LKmgkhy+ZcYKXY0OMBdF6rgfEncaTSZK7ZE/m30LIKZxGFisayoitYrPoUKgQFilK JvtrvqLBc81t+lTUPqdiALN99CIl4lL5iiGoJzH4SmvIp9lTCLyWsuBMqJ5PpfanZxmV/N Ro/wN4dr9AdUz3PKRKyK9FUdOlBL5bs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1627464368; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5viwOi0Ex8EMpcyt5fZAmdaE8zZE3JenBgOEfHjTO8U=; b=XqnccbRI7Ba90MUmDKttFQTuMWonwuyX1swzv/h7m5E54hesuDgaFK/aI8UPg+OaZi/FOS XAEigI499ra4OLDQ== Received: from ds.suse.cz (ds.suse.cz [10.100.12.205]) by relay2.suse.de (Postfix) with ESMTP id 8903AA3B8C; Wed, 28 Jul 2021 09:26:08 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id C207DDA8CC; Wed, 28 Jul 2021 11:23:23 +0200 (CEST) Date: Wed, 28 Jul 2021 11:23:23 +0200 From: David Sterba To: Dan Carpenter Cc: Kees Cook , linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-block@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH 02/64] mac80211: Use flex-array for radiotap header bitmap Message-ID: <20210728092323.GW5047@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Dan Carpenter , Kees Cook , linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-block@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-3-keescook@chromium.org> <20210728073556.GP1931@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210728073556.GP1931@kadam> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, Jul 28, 2021 at 10:35:56AM +0300, Dan Carpenter wrote: > @@ -372,7 +372,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, > ieee80211_calculate_rx_timestamp(local, status, > mpdulen, 0), > pos); > - rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); > + rthdr->data.it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); A drive-by comment, not related to the patchset, but rather the ieee80211 driver itself. Shift expressions with (1 << NUMBER) can be subtly broken once the NUMBER is 31 and the value gets silently cast to a 64bit type. It will become 0xfffffffff80000000. I've checked the IEEE80211_RADIOTAP_* defintions if this is even remotely possible and yes, IEEE80211_RADIOTAP_EXT == 31. Fortunatelly it seems to be used with used with a 32bit types (eg. _bitmap_shifter) so there are no surprises. The recommended practice is to always use unsigned types for shifts, so "1U << ..." at least.