Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp2003lqn; Thu, 11 Apr 2024 11:47:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLT3W/aDhg+domYz+SwltfAJwt6ZNW4HrPCTm3BV8cZi08ORyqK3XBOq0IUw3dNnkr7VP3uYlME1dLnJKaODjxSt9g3r83L0Sjx1gCNg== X-Google-Smtp-Source: AGHT+IEHSZaDA/KZdM9hxw7JzMeDZQi6RLPQkpTxcLxsavpSqxOqUwFTn3PNycunk3E189Ky3GRI X-Received: by 2002:a05:620a:4726:b0:78d:3ffe:3467 with SMTP id bs38-20020a05620a472600b0078d3ffe3467mr649430qkb.13.1712861234329; Thu, 11 Apr 2024 11:47:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712861234; cv=pass; d=google.com; s=arc-20160816; b=x2uhWvyurVlcGOll+3hgiwIODlHtdx2GzwBBin4wdXokM/pKpvXvfIfGljpCyZVVhZ ykhGy5DV/V2JK81S2BZfvXgYVRYGy4XOmF4Cti4WRe9sD0Wt4IE8kZGkniXr8MvveyCH p8wtntK8CbGniTjkufrziG2MwFZjMn9WAC9zYMkZydrZDeZpQ0QpP84HPC+bPKpWJTUf O4RF5XzmOpq8rJg94/ZI6kjv2Pz0MXxb7fgpRXCXw3G0lh+2P9IwCFEUW0/oKbMm47R4 xLpHa9wWZXzu6S5F6UiLcQaozttbqFUIoCywhvcIfrY8d0NyooiKTTOb6tgPUpvPvQSd bXgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=q/6jyOi9vYXZmntQfvg58BRi7VAF9LH3LgKsGY1440U=; fh=9aHdJ9uk5KNiYzs4qj4y1LliCcuqcm3jQjxhKyEcWow=; b=tTSlYon4vDPAV59Su3dswonc7M68WJEPn56ozpeOXEpwg8K28NSJZjd9+3Pke0WKk/ SdBOgXvMnUGyu6lG/kK6FG2cMiV7hqOHUb3+tADzb2JJdE40ar9rmafwITNClPituqAF KkmfoVvBopEHUqYpidUQFAc2X+VywmpxDgW3SC3a0AlLtsmUsis+zShXucO7nth/DxRt Oi37sUHX2cn64EbqKv/mP2aOCqRwwufCxSZv5lMMiHKELewnDMXxqrNg4Qv6Z9+fcFYZ dP5HTL5nWN5/GEF/7Gu5GNsgVK+ufyMsMqOBzc7bYvn50ide9uLe7Dyw3fIcNRoNa0nF hW7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=De7ESMTs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141488-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141488-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l25-20020a05620a0c1900b0078ebe8d4d8csi2040096qki.450.2024.04.11.11.47.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 11:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141488-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=De7ESMTs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141488-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141488-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EC4881C23007 for ; Thu, 11 Apr 2024 18:47:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54314205E1C; Thu, 11 Apr 2024 18:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="De7ESMTs" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76950DF5C; Thu, 11 Apr 2024 18:47:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712861230; cv=none; b=d8MXoL0ZWGBsZwGpdXcrZU/KoRCBnRjiUyuuVO1dY0CC3SW8inP2+NZH7JmXJ1BVKfWkj7p2VNSZOczmAktIUVhEcmOjOdofKWyNozRFI/zLucxolY6H4cSi1U/1R0VPfHYfZmu9V4vBbACd2ZkjhUdGs3uvZyTg6+wBrLZ67g4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712861230; c=relaxed/simple; bh=MCeR7HtXL7nbj9uUbgxs72avaXllwlL5Zu3wM03KPLA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=crhKlZoeB8YLa/70tVKsOSYt5ZUAtQ0fRx+LJlzd97/KVLoZRJBgdnJsiGgwz9yVvJtyPRlLqmuZgNpqVe3Ki1SimA11n/Z2a5WblHhpZClXrEsjZ3MKsMyCzTo7r6ghdfGAffRlFhMsLCT8GP9TJfCUh0BpJmCdIJpU2n0v/Ms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=De7ESMTs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DACAC072AA; Thu, 11 Apr 2024 18:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712861230; bh=MCeR7HtXL7nbj9uUbgxs72avaXllwlL5Zu3wM03KPLA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=De7ESMTs/7MYP2JnavGZGYEyz6N/7fYQmuLWAZ+K1zgQNOGKxGyN/uGL7eS+4QeYl SfZa3knyteFFXBQ39dEaunMhzCgxjza3gMgMvCXqnuLyGk13Q+hg4PNKZmAiL6Ywnv XrYKvb3Ifw++Y6/Kvr7KIMro4g0fW7MzhI19oE0FZzeZX8fzqgxg46rtE5wmRjd8Fb v8K+vBi0zTZq8hplA+tCBOjuM4q/Dop8Rv3q8SSFbgZ0wIlWy8PnasGM0fDVCbba8R nNfjlaUP90z5VZELIByN671DugpZNvnWyRQ8IsBkndZIrMHpcKtesXLW2uQW3bzfFI bX3PGc+eSZMAg== Date: Thu, 11 Apr 2024 11:47:07 -0700 From: Nathan Chancellor To: John Stultz Cc: LKML , Shuah Khan , Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Stephen Boyd , Nick Desaulniers , Bill Wendling , Justin Stitt , Oleg Nesterov , Andrew Morton , Edward Liaw , Carlos Llamas , kernel-team@android.com, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/3] selftests: timers: Fix uninitialized variable warning in ksft_min_kernel_version Message-ID: <20240411184707.GA153244@dev-arch.thelio-3990X> References: <20240410232637.4135564-1-jstultz@google.com> <20240410232637.4135564-2-jstultz@google.com> <20240411153945.GA2507795@dev-arch.thelio-3990X> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Apr 11, 2024 at 11:11:59AM -0700, John Stultz wrote: > On Thu, Apr 11, 2024 at 8:39 AM Nathan Chancellor wrote: > > On Wed, Apr 10, 2024 at 04:26:29PM -0700, John Stultz wrote: > > > Building with clang, I see the following warning: > > > > > > In file included from posix_timers.c:17: > > > ./../kselftest.h:398:6: warning: variable 'major' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] > > > if (uname(&info) || sscanf(info.release, "%u.%u.", &major, &minor) != 2) > > > ^~~~~~~~~~~~ > > > ./../kselftest.h:401:9: note: uninitialized use occurs here > > > return major > min_major || (major == min_major && minor >= min_minor); > > > ^~~~~ > > > > > > This is a bit of a red-herring as if the uname() call did fail, > > > we would hit ksft_exit_fail_msg() which should exit. > > > > Correct, although we have not really conveyed that to the compiler, > > right? exit() is noreturn, which means all functions that call exit() > > unconditionally are also noreturn, such as ksft_exit_fail_msg(). LLVM > > will figure this out once it performs inlining and such but that happens > > after clang's static analysis phase that this warning occurs in. I think > > a better solution would be to add __noreturn to the functions in > > tools/testing/selftests/kselftest.h that call exit(), so that the > > compiler is aware of this through all pipeline phases, maybe something > > like this? It resolves the wawrning for me. > > No objection from me if this is the better approach. > > Would you send that patch out? Done: https://lore.kernel.org/20240411-mark-kselftest-exit-funcs-noreturn-v1-1-b027c948f586@kernel.org/ If you have to respin this series for some reason, feel free to include that change so that they go together, up to you though. Cheers, nathan