From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 C177A278156 for ; Sat, 13 Dec 2025 02:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765592916; cv=none; b=sIn2+HdskY77RO2kdxU/kHR3JWCIUVG4bmX5bs8eCqQAUY/f4ftFLv5R3d/P5cawgvCyGgNBQm9xFslIfqAyxgeAdPaz3hAwibldxipjK1o0Tvos7U4G0sf0SXN+w6XzCz3IIqwjGc87kbLdwi+urVc6ZJXrfzxSbLQM1L4rt+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765592916; c=relaxed/simple; bh=0x1vMcMShduTmxRWyvBiBRlMvGc3ZDzpLSl3K9pvsVg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BBYVjvzi/D1/WScFT2sPsvJIa6QGG0hHQBHSuIRXHdX97Sr3aPkonaJUzCRZB9DUHj/VLxZXuE845K4tEsvDtEHDA9pqtgwzmPdzoaV7fymD8TtZFE6d6NhcQi846W9Jgns8AfeIMdS45sTma2TbxdBb8XhnVrCGL/wbAp56dXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fmiqz8yK; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fmiqz8yK" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-786a822e73aso18182747b3.3 for ; Fri, 12 Dec 2025 18:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765592912; x=1766197712; 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=C8tj7zFmiGIgl+/XLeshTiYqJVDhHxNQCvlvR2nqqLk=; b=fmiqz8yKiqzwLZquhd12/HuAp0bAsycTk1IlQwq43jp1H+NwQRey3u+yUmkcuZ+GpQ Xjse24767hWTx2b4gn8vZknuwop1ABNj2Hxxv+gESdZlhSdErhrsZmJAGkUJTwBPMQrU Gkyiib+2WqAOMVAQ3Ox6DZcdiw1w+HayrQ8bl2Uw4cXpnt8A3jeq9WD/Afr9zhD938jx dgOHo0XM/qL974u73KDD+UZKwdejRXMnCn0IdMEsbS9ZwhpWq/LWUT9vBDG42ReDlwAb vPA8YPgH7nBoSXaQescWuyeUbx+CISriWu/bauQ8jjQxySlmmjAyF9+xtR+rcPHMj6zH 3r5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765592912; x=1766197712; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C8tj7zFmiGIgl+/XLeshTiYqJVDhHxNQCvlvR2nqqLk=; b=F7zDQ0Tu9ZxQVOOnG8z4uK7GlZnus85d5krev2GFFdnEUv4ZQWDRYJQjNANGFNP3DO /EHaNiWZ2i+eAY4/UtXxKYeHHzbuvZJe5vR1yUjNe5nGTZrfdONUlVFn897zb1vZklmX j/N9583S+0fDc5V/WN6h03//x6gfbyxkGP/qwVewQBjJNDZWs7eb7tw1cQyS2SjzY2rx 3WGjdNQc3eMYee6HTKPh4CHXw6LygmW0mArXlc/cZZzqUdKgDsG1jFT/nPHJNZBFkjh+ tqddPFKHvIE7vUPx3FLUnlqW5rbEZ8ytNGvmAn8JcpDGafBXXuf1IYDN+fzxVahqoXQ4 y2Vg== X-Forwarded-Encrypted: i=1; AJvYcCVYCfuiQDqKGzh70ZpyLp4bpBoL/+LKDbmyn/F2cK14J8AxUL9J5fjIHPlGGULfHNdX7w+nI7S/ZuEBMvo=@vger.kernel.org X-Gm-Message-State: AOJu0YzksuIOUob07z70CwhxDFOW6KZ5InufEcsc2JYLUTZzoPd/wURw mDvfCSCC/zLxlPdfNaPykKEFGR9TwhQg747kfGjA/EW2xTbsuo7cwL0m X-Gm-Gg: AY/fxX7xh7xpJkXKMWz7+gzJfM5W7Ur+JNopqaxIN9sywgapLFMZ48uiOByymkgiw1I i5kAZsavNl7OKSMpMUAmU45trHVFYXkSD9DxCxH+pT+POlkdPABUm66ZdZh1HqBZsS/EdiIO+6e L/yIrCznPCwdtFWBl7u2MWxL4rMOkCrAIdhztopiLXNeellc9h0VSrsE4dO1263UVgK1s4L+5bH JJ9YCza451XBDQKDM8XO8szZVTlwLeSv4TckQEaB3/dtnFK8Z824n/0OszybTNNXtyz7/kWu+m3 OqcFgaRwQ+jBWsBGTZQ44Ktt3GhfcRzGwtyWBM7tKRRwqhBCIJ0NDkr8ot6KWZzGcU8Kl0Zgpt8 iM/0lE/hclLSC115rQ1MpCcjBLa1QW5PHDFKeVcp2PY1xvo9tM5tjtTkPPYqkTiWgP91V6Zyfe1 mVKZh/nA== X-Google-Smtp-Source: AGHT+IGpiya8RbWHXeXIazjjoeNE0QQuWIrlOz/AC0+4esxyba8hfzVjiroZs9tNrTzZxt7cJ04SSA== X-Received: by 2002:a05:690e:12ce:b0:645:5b0e:c914 with SMTP id 956f58d0204a3-6455b0ecac8mr1974338d50.66.1765592912124; Fri, 12 Dec 2025 18:28:32 -0800 (PST) Received: from localhost ([2601:346:0:79bd:86f:7039:22f0:5fbb]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64477db607esm3280998d50.18.2025.12.12.18.28.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 18:28:31 -0800 (PST) Date: Fri, 12 Dec 2025 21:28:31 -0500 From: Yury Norov To: david.laight.linux@gmail.com Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Geert Uytterhoeven , Alexandre Belloni , Jonathan Cameron , Crt Mori , Richard Genoud , Andy Shevchenko , Luo Jie , Peter Zijlstra , Jakub Kicinski , netdev@vger.kernel.org, "David S . Miller" , Mika Westerberg , Andreas Noever , Yehezkel Bernat , Nicolas Frattaroli Subject: Re: [PATCH v2 02/16] thunderbolt: Don't pass a bitfield to FIELD_GET Message-ID: References: <20251212193721.740055-1-david.laight.linux@gmail.com> <20251212193721.740055-3-david.laight.linux@gmail.com> 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: <20251212193721.740055-3-david.laight.linux@gmail.com> On Fri, Dec 12, 2025 at 07:37:07PM +0000, david.laight.linux@gmail.com wrote: > From: David Laight > > None of sizeof(), typeof() or __auto_type can be used with bitfields > which makes it difficult to assign a #define parameter to a local > without promoting char and short to int. > > Change: > u32 thunderbolt_version:8; > to the equivalent: > u8 thunderbolt_version; > (and the other three bytes of 'DWORD 4' to match). > > This is necessary so that FIELD_GET can use sizeof() to verify 'reg'. > > Signed-off-by: David Laight > --- > > Changes for v2: > - Change structure definition instead of call to FIELD_GET(). > > FIELD_GET currently uses _Generic() which behaves differently for > gcc and clang (I suspect both are wrong!). > gcc treats 'u32 foo:8' as 'u8', but will take the 'default' for other > widths (which will generate an error in FIED_GET(). > clang treats 'u32 foo:n' as 'u32'. FIELD_GET() works just well with bitfields, and whatever you do breaks it. I pointed that in v1, but instead of fixing it, you do really well hiding the problem. I see no reasons to hack a random victim because of your rework. So NAK for this. In v3, please add an explicit test to make sure that bitfields are not broken with new implementation. Thanks, Yury