Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2793867lqz; Wed, 3 Apr 2024 08:47:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUThHdQwFgindPGjHnafrWRPdAQLQjQAiYdAqmAWq9bP2z6MG1ff6sfF7tert1ACtUf9iwAatP1fRnhCzMX2jWxdt7YMkEybVoc0R2Oow== X-Google-Smtp-Source: AGHT+IEJDUxE5JkDvXNAw83qDUqeN+rqwtHHUrqFfn2+BKNSB86bO8qPl0FxbCsxGFPAKIquBW4O X-Received: by 2002:a17:903:2b0e:b0:1e2:7c72:767 with SMTP id mc14-20020a1709032b0e00b001e27c720767mr4551236plb.30.1712159231661; Wed, 03 Apr 2024 08:47:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712159231; cv=pass; d=google.com; s=arc-20160816; b=Aeem8zi2BEStNrKuZ3Hch9N+4VNRHiSL9Khi5cGnzzn2SxlN8OghEcIkZgTQjP95cI Bl68crNV0pSgdnh6oGxajdkmInj94k/N2dcbcikVkzOii0rb2FidnfHK/2y4DKiXbPHc igkQL3M8lqIBu7KBc90sZKTvQ427JlZF/7gp5D0YDREnrUxKhKKd4XhJ4lrFR0t4YJ62 m0sL94r4MO6VRjp7bemT3LIco5NuIzavWexzVkchxC0MDMQbNEC15MDeGhU/tgjvvcA/ y588daykYVy8toyJhKIMCXzOj+nZONinTsW/p1+mHZviF3MANQ13DxmCrnSIrfYtFRbp x54g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=o3Q5Z2ASolvH2m9d3d+Ytjc+Iku6KsM1X3ZuAJ30QD8=; fh=6mO5AEq2y8Kzh/UzvyGn/YAlOiOjUWGk4yqgqWltExE=; b=OVuq812txg8koUxWzWaIaCmJsFXTAVIYpBQ7pDayOSKVPFDQUylLtkmfxiKezgJJUM g48kLnX2BUOKnDA6lzQYF3JUZtX8e+EaLVhNdxc/Iu/wObbt49apA8Dx5EdEOHyKOJ6D /8+npStEMqH5SLtk2U+AAS8PCf6LZEOpvwbuBooY5xAf1lNSqLsgvE3a3vx0q/7UjxH3 N98l+HCJYGaauqVcWuFLl7klNyh/V9lT8RxjzxqvbPnA0qwR8v+Wl3nZR5iVIBhpudJ1 x3vV1D5+56wlmjUdjkbv3ZWMkLbQES9QRspYZBjEmQ/qC62ndQ7+gi8A9L9GgC2mr9Fp FV5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=hKOmOEp7; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-130119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130119-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k4-20020a170902ce0400b001e29225a4e4si1431157plg.296.2024.04.03.08.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 08:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=hKOmOEp7; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-130119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130119-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B97A28F57B for ; Wed, 3 Apr 2024 15:45:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 607C814A4E0; Wed, 3 Apr 2024 15:45:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="hKOmOEp7" Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C5E0143869 for ; Wed, 3 Apr 2024 15:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712159138; cv=none; b=KWSHdkGgo6yladtc9VAjg23i7hjcAruvgTHoWJzQnoFJtohnt4vVkbLxKOna+PBnV98wFbcWdqlhFTaQjkqlc0kbk7W6YavmGg6nZ+/efQkZ7LwdzxsTMr5cydCQYvGUsNfh/jbtcB29aX5jExUHSDq/wC6heZFx0potK79CP9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712159138; c=relaxed/simple; bh=zLgexbW2g6iQ/DV/NnjSU9FIqF8+vQiRbmJEWt49Ryo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KoyEGR/v3Zi1TRimfBeqF2lxkbsyoG/VLEKP2Y5yQo+lmnVS3WHWMvYa8w1bgNHpplqFe6ix8xQv72C08DOMbO5wZcEOV/8M/2ewaL7IRYvZRUZDxJaseNlmdZ4fGk1RZ7V/35Eqbg6UGps4Vc5ksPWrbcUkHIibOjvgXt5wWmc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=hKOmOEp7; arc=none smtp.client-ip=209.85.167.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c56c6b5a36so360130b6e.1 for ; Wed, 03 Apr 2024 08:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1712159136; x=1712763936; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=o3Q5Z2ASolvH2m9d3d+Ytjc+Iku6KsM1X3ZuAJ30QD8=; b=hKOmOEp7D07F5Dl3op3Zu5QHXUNTKTMiPUEhMLzgsJoDtTsbIwvDhlI02nmQUaC9bY lRHA4gWf0KzpvVLsAUqHdza09y5g1me/Hz9ZkghM7bEafNMnS1HyCshGlISNGYWxOkMT 2f8wJCKwUiYuSDd8BntrxTqs4d1SuVL61avxvE3ko6hnskshLwaBL2UtU1s3rz5iAT6M /p/RUvj/omyKOrD3MDY4Ox/vHatN3NytlDuPJwSBYkXEn31yZGXWqCCAF5futwN5KfYX ZwlU0UXcp9MZkWeCmOa+R0g8A9aJslvwFrPTW9Q6z9xvMHusaLWDjPBpfbK95Lk/iLYC UK1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712159136; x=1712763936; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o3Q5Z2ASolvH2m9d3d+Ytjc+Iku6KsM1X3ZuAJ30QD8=; b=w3b3WsVTl5v85N8JF5j6HUIUMYrdYZnt4QrKtbPmtkJmhnDXTzUIMcQBPQ5+TqxiZt fZ/jTPM+bJMQo6lW8FposZxbWFOCQZOHfxmg7XICi/3RK9MshHXRb0q14xzH2O75cGAO ZK+I/xq7erY4/ukS1ENC5OXlQTa8C2d42chEXj/SvOtroztpdrnP2ktuPz5XRdV41DeC SQXnyCBL8eq70qOoWHB+SgtYbuAuHBEPGmjxZbUpM75Ul2oQz94GMDGQ4MOVnT9slq+e ++TwypcJUbNJcFFk8EDnzdqe72Y7vCUbE1lENv0bAHbfADuKa0zCyaJDZw3gxjKra/ON xTqg== X-Gm-Message-State: AOJu0YzbqUK0seg+rBlMoz1oeNEEI4peaF2vmVRmE3rNRvrm+lFzt49+ MKX69G3C/ZerDGFc93OIu//Uq0vXU2SjcQDteG/duEPLFcDbrBXE9gnSV4pT30c= X-Received: by 2002:a05:6808:152a:b0:3c5:d42c:48b7 with SMTP id u42-20020a056808152a00b003c5d42c48b7mr1387796oiw.29.1712159136219; Wed, 03 Apr 2024 08:45:36 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id o23-20020a544797000000b003c3d1b47532sm2495301oic.49.2024.04.03.08.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 08:45:35 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rs2nu-007hVG-P9; Wed, 03 Apr 2024 12:45:34 -0300 Date: Wed, 3 Apr 2024 12:45:34 -0300 From: Jason Gunthorpe To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, Leon Romanovsky , Nathan Chancellor , Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Kees Cook , "Gustavo A. R. Silva" , linux-rdma@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH 7/9] infiniband: uverbs: avoid out-of-range warnings Message-ID: <20240403154534.GE1363414@ziepe.ca> References: <20240328143051.1069575-1-arnd@kernel.org> <20240328143051.1069575-8-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240328143051.1069575-8-arnd@kernel.org> On Thu, Mar 28, 2024 at 03:30:45PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > clang warns for comparisons that are always true, which is the case > for these two page size checks on architectures with 64KB pages: > > drivers/infiniband/core/uverbs_ioctl.c:90:39: error: result of comparison of constant 65536 with expression of type 'u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare] > WARN_ON_ONCE(method_elm->bundle_size > PAGE_SIZE); > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ > include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE' > int __ret_warn_on = !!(condition); \ > ^~~~~~~~~ > drivers/infiniband/core/uverbs_ioctl.c:621:17: error: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare] > if (hdr.length > PAGE_SIZE || > ~~~~~~~~~~ ^ ~~~~~~~~~ > > Add a cast to u32 in both cases, so it never warns about this. But doesn't that hurt the codegen? Jason