Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp64586lqn; Thu, 11 Apr 2024 14:03:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNmNw3Y1sfITFu/fbfN+ZXUC742AUNY70mZhGMAk/MYSVsw3H3vAz2Gv/dDahMP2PnC5q8KqMb0J82EisTdiN4Dr5Nn/UecDaiFQLYSQ== X-Google-Smtp-Source: AGHT+IGvwTDGfr+OsMnpu6B1JWvT58MJSk1/8/R8YG6QdZ33u51m0uuhtEndYv9iWVnDfH0x12Kq X-Received: by 2002:a05:6358:c695:b0:183:e8d7:6f58 with SMTP id fe21-20020a056358c69500b00183e8d76f58mr461285rwb.32.1712869409733; Thu, 11 Apr 2024 14:03:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712869409; cv=pass; d=google.com; s=arc-20160816; b=Atmvmfc5hu7SQBHePnY3qv55z2VvIGfiPifal7bGe9jovBr66vR4g9b8XujR7SiChC 0+YQ2Vhn11zevpAmqDmLJ6hOzI/ytFxrXajQqnFv3Xpn7oO9qJW3DxPhUbrtNWlMcXVn 3i2Wc63p2Cuto8xcR/polApYE/P7ZV8Px1FBNliWkqj++NGbw4B0lSeInt6kueeEQbqv leFzTXewBndYYf+iNxFS0L0KRilLMQCSdBZpEu5A9uZv7L3koGy9pixBKXvtgpa3PGm0 BFhrNsJnyRmoShgmWBRjj2wi6ZGUt++XfBMQMz6HZB/ZJoPfbNiww2/q1+4IGup5Nn5i mHRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Mz0LAgWqLQ4vIJA31FUrD4xAYvlItStjsWSzrqzF/DI=; fh=B6j1hzlhIiI50tnuMul04BeriZtPzLCN4lJTxLPzvu8=; b=MmK4O9NY18aEOfwFo75lyRgqmcu/2Yeu90aKYV3g9rc6syehXzsQWVCiZFA5E86dgR v2zb6McdKETWnwV0ZGYKXUQc3vl6tlMQZh7MiOWwlrdcQmDeV8DLxzEqhSc0WlN48Ga9 uBFS24lEC6Z4XztwfXh09gmGpRLJUpsvxF6Zgi8rY4DKWCeI6Ln5+HgJfLfAW4OjDFr/ 49+EuU8IXP27TX9gbjQR7d3+qumpPs1O35b4NqPJJQOTU/jsGBw2taV/Vg4yFtWXKLap jGJYkW3BY/PCzweft8K/eEWm3aQJqI4tVYIVhTHSjVpiWMqKaxyf9VvMkgISMEaNtJ59 yAVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=TGreNy0Y; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-141602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c10-20020a63d50a000000b005f077dd529bsi1862150pgg.773.2024.04.11.14.03.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 14:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=TGreNy0Y; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-141602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BB30EB225AA for ; Thu, 11 Apr 2024 21:01:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C63D15E8C; Thu, 11 Apr 2024 21:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TGreNy0Y" Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (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 D88F013AE2 for ; Thu, 11 Apr 2024 21:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712869308; cv=none; b=WUsljnMf3vjlhN3Zjw8Fv20PCFlV/XVfsueJQ3/BKCeIsLg9VRlOLvxZ1dcww9Xq3bFqfJ2mimNE24TSQqLKc8UbHpMa/+kN/pHhwoxofd7Nbz2CXXNh1vSXiMKEs8YPi6J6lAjWFTQX2YBJc5hNTgVi49vnjn2jyvTqHTaoYG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712869308; c=relaxed/simple; bh=g9Z9OwBbBlUj3EmCyyduc+Z0LyVTi1wB3j1o6dvX7K8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jXyqZXY4imNKL0qZBs5N3wIjwWl2vUR3cBccLE9VTX4tX6vgtJjlYe1LBogABRtsccbUN0z1RAKLP8sNosK2Fn/5MK6eaJGHd6+WAEvJVZMbdXdMyu1fiasPAvjLET7Ac1pB1xVrvh0cBclD0Jak8DKEJVPGxz4oTS/g4OCmUP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TGreNy0Y; arc=none smtp.client-ip=209.85.166.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7d0772bb5ffso5314839f.0 for ; Thu, 11 Apr 2024 14:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1712869306; x=1713474106; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Mz0LAgWqLQ4vIJA31FUrD4xAYvlItStjsWSzrqzF/DI=; b=TGreNy0YEyauNqSeD7GlkAQxUm5gG2YbbhaBo/UkE/dAl7IfY3cnQVL2vggBcJMgLC EUVM2YwOhvW1PtPNd90BIOF0Q5x5JyhoKERjumgqE3xBinuhNhw6HuKBYWu/S6iMn8f/ U9t4d3BkJGF247iWhkprUjqBBigCeBJr+EleA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712869306; x=1713474106; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mz0LAgWqLQ4vIJA31FUrD4xAYvlItStjsWSzrqzF/DI=; b=fQXa424T/tW7CEBbFBdGUz3m0EVa4CaMJjfAM7PG1VwQGsqyTPP0beV6fgVTfz49aU dVVeOuMxJ69lgdIaXYqU9l6wbZp+COGv9ChxnCPkrAOILfV83MPa3aWlecG1RDQmk14l WZUNaxvlaC04ICmL9V0vZ+JD9qjemmA9AIqrKebC9D1PRE3QYxMUcXpD0reMlxVVDuhK c6MMXqWi3xP4gTkh9CLQEvyi3eeO1/nObYqDnM8zRUKrdtqkfu7luxZgbuI7keuNImLC 4QrHKJBoLkUbzqH1xO2qnH2uwFv855Rtw/Pvg33WYaAN3RhtTUOkE79gw4F6gxR3/YwE +IPQ== X-Forwarded-Encrypted: i=1; AJvYcCUwZ4drR9Q9XJ3ZgQ4HvcISkz6ksKFOiZWMp6kpu73aBuxCYyuFWoJIuHuLi2AWMCy4IYbu4maX6ksYdA9x7k+4pAokipjcyKfw3CEd X-Gm-Message-State: AOJu0Yy2TOgBePppX9Di17CZNXYt3B0klnwSU1YyvgIo+Tsh37BnMy+N QNeA/9WPKJx5qCD8tKhhMHyvlaVtQdkD6wodE1/w28ezAJgxaH0g2tsdSfBXO04= X-Received: by 2002:a05:6602:4ed7:b0:7d5:ddc8:504d with SMTP id gk23-20020a0566024ed700b007d5ddc8504dmr982307iob.0.1712869306060; Thu, 11 Apr 2024 14:01:46 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id u22-20020a05663825d600b00482b91da84bsm605270jat.58.2024.04.11.14.01.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Apr 2024 14:01:45 -0700 (PDT) Message-ID: Date: Thu, 11 Apr 2024 15:01:45 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior To: John Stultz , LKML Cc: Thomas Gleixner , Stephen Boyd , Anna-Maria Behnsen , Frederic Weisbecker , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Lee Jones , Muhammad Usama Anjum , linux-kselftest@vger.kernel.org, Shuah Khan References: <20240409202222.2830476-1-jstultz@google.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <20240409202222.2830476-1-jstultz@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/9/24 14:22, John Stultz wrote: > So, the struct adjtimex freq field takes a signed value who's > units are in shifted (<<16) parts-per-million. > > Unfortunately for negative adjustments, the straightforward use > of: > freq = ppm<<16 > will trip undefined behavior warnings with clang: > > valid-adjtimex.c:66:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value] > -499<<16, > ~~~~^ > valid-adjtimex.c:67:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value] > -450<<16, > ~~~~^ > ... > > So fix our use of shifting negative values in the valid-adjtimex > test case to use multiply by (1<<16) to avoid this. > > The patch also aligns the values a bit to make it look nicer. > > Cc: Thomas Gleixner > Cc: Stephen Boyd > Cc: Anna-Maria Behnsen > Cc: Frederic Weisbecker > Cc: Shuah Khan > Cc: Nathan Chancellor > Cc: Nick Desaulniers > Cc: Lee Jones > Cc: Muhammad Usama Anjum > Cc: linux-kselftest@vger.kernel.org > Reported-by: Lee Jones > Reported-by: Muhammad Usama Anjum > Link: https://lore.kernel.org/lkml/0c6d4f0d-2064-4444-986b-1d1ed782135f@collabora.com/ > Signed-off-by: John Stultz > --- Applied to linux-kselftest next for Linux6.10-rc1. thanks, -- Shuah