Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp700020lqm; Wed, 1 May 2024 12:54:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1LWqWZxqrS6DpCdDgTg3uN+wxU3/XnE4kblgqH8Zi49CepdukqdQhBgTHK7SozrZgD/lqUbahLBBDzcpp08mZMKDn0p547l/I9QmpQg== X-Google-Smtp-Source: AGHT+IG0TYQORNkJ4dexXugSuiHZLh7YMETls4da33X4G80Bmi9GTVa0HhyCkmL2kvKazLONECYc X-Received: by 2002:a50:9b57:0:b0:572:7142:4594 with SMTP id a23-20020a509b57000000b0057271424594mr1973990edj.29.1714593291041; Wed, 01 May 2024 12:54:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714593291; cv=pass; d=google.com; s=arc-20160816; b=N107ppRaZ8qF+xZT2WBPFjs01Q2ns20Pw1dofa8fz7EQbtpMmvAlu6IbmmaPz1fZge wICANR6vYMQFZ9ZzCVhjQgW1Sfg+hHg29gl83+ecSel41KdRx06uiaJNpvUAJ3PAK/hI 3dydVWBUakHKeGUX+ps379A4MABVHCb8lEAtFkGWMzI+K2d+K1ws022hzS3GV+FfJkyy 4AowPd5q+ltbqLOnqgSf+6Ro7O3gt6nxsx+fYM1YhPR1aWMQbGvhBJXxVP1Uv6/b+Rax 0MY1+7EaodnAtrhUeRAoJ2sdpUCeNwqjtUepPomFQLOg79Vt4wQlq4M28zwLNUoEeA0B TMaw== 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=o3qjMSjjDTWfiqOEbDNPmH92wnyK6R57JD3befS8Eeg=; fh=8AZiDLIMy3AqhIQMf+573+0svYB61RgOQ4RkrkkUnv0=; b=GRk/76YNJkecoauAglenjL0QFUfuwowlrwy5uxDIXO1yBNUTaOc/gDUx2hEzBGjjbP Foqtx4pq/eyLB0p+ju0hoUfnnECyX1TnKwwNobpveDiEPD7AgEA2j8nb0k1BPgSk7rZ/ Av9cN5moWsiRVc4IBRyWZDbosaWRyEqcD+LWgPDbqbZ/9cjiJl/wCU80rEslg2ehXqix VeJoV6//CNX5SxT+BdPa59xfR8PIXQlFiZ2MP2M3GHrNbweXLbXR7UI9yQZJZqHmI08I r6yLbA9D5gFfj7G6+8IqF77Gg6C1uMOU7w/55I8RpbFNSLbb+M+sqYJZTtTY2n6d0/7l 2/LQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aNuSTsxd; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-165727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b11-20020a056402350b00b005729ac53b46si2022334edd.606.2024.05.01.12.54.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 12:54:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aNuSTsxd; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-165727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B22511F21CA7 for ; Wed, 1 May 2024 19:54:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9838137E; Wed, 1 May 2024 19:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aNuSTsxd" Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (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 DCC7C161320 for ; Wed, 1 May 2024 19:54:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714593283; cv=none; b=CLD8wO7FbnGk5eHUX9VASGlw8OCY1sbj5S8IY0azTBht3q6/t4Z4rHosOM16I/MnZV6srHAnpipqkXTcxdwV/1o64hDIwzPNjDRbb6ERUIuAfBW/No1S0XHl2XcMXItTnPRbpLMzV0kKXJaHHYWmR1PZ6iLhcR5YCULul4Qt9a4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714593283; c=relaxed/simple; bh=3AFePkdooPErfFu/qbXBokEPm+8+qcbQdefFXCyvhhE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qebbmVHPcfGORYTNxY3TjXUTV6sWgeL9QhbQEa4dzNIRXWoh5njG5zjUZ/yAkWSS2fr1H2G7ZLHIqvfRbjRXywKfzY4+weZNHKx/7NZv8bBB4McgNwsZhMNOjhK7i8ZEoHitdPuzN0OH6IWayFOiaz/RK+wGmcStE1cyScy2xkQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=aNuSTsxd; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7decd8cd028so160881739f.0 for ; Wed, 01 May 2024 12:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714593281; x=1715198081; 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=o3qjMSjjDTWfiqOEbDNPmH92wnyK6R57JD3befS8Eeg=; b=aNuSTsxdZmgG85sScL/nfJYe1Mbz1e3SPwZGzUqMj5b26GVRWAKXmBYPVlsQjvQob6 37tcwIzjfIQm5xLLv7s90JjC/OfKdywLrWnxUX0WBblntFnQyijsoBstFU6uZzodU8fM jKRVkb8oTiANGs59L4RwaCicFJBpavw9Fo8+6EAooIPp1lkJnVUhglOehiAl6LGBxl3S I8ouCYnuSH5jILjiIjYvUC82vDbwFsXLDHAnqu6HSo/nl/rl/y8HJuiCwaNuObguyXf1 MTRSjrABORasTaMv3I4+vKBuYx5a1EM1M3fQajSHmVjv+PHtbTId1L5xMZ0FNNGdwj7g u+vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714593281; x=1715198081; 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=o3qjMSjjDTWfiqOEbDNPmH92wnyK6R57JD3befS8Eeg=; b=HZkj1j5AmFn3jnavlyvhfq75+Qdnwl3pNdWaO13eG9mTZwheIe5phWNI8EIsvrG9cf aKChAtNtGbYrTaeQwWc95hRnUBkUL1Lte0MbmvWTMLGd0wwJCfAsS6r8lZBlI8OJQJvs rsp/BZ5QkCs1yojMmPWp8MgjWzrzCsW75tC3bg6IFahsljDpbVxfMqQUoBZ8YbRYc44d PoTxpAA+G0+xVF3NKFfLqJm91lxK/DUBwS7tfI+eZ/RnVxIM6AJRzv/buNtEXXcxAptX 40/sECkJ7J3620RJQ1D+pvKifYcQtlKe4V8M/9m487bqpCUs3CRNRDjAsFHjJ5gHft6o ppbQ== X-Gm-Message-State: AOJu0Yyor2VtUGBmGPsqb6k2po1615flKpIniTpHoswfYJj8dxzDEDk9 2mWZdEqXmNiw0Y0QeVSHQZzc1zWfwuWE/hQozHC306JnCr58k3rqiMTAer+gCw== X-Received: by 2002:a5e:c80c:0:b0:7de:ca48:4fab with SMTP id y12-20020a5ec80c000000b007deca484fabmr4093192iol.2.1714593281030; Wed, 01 May 2024 12:54:41 -0700 (PDT) Received: from google.com (195.121.66.34.bc.googleusercontent.com. [34.66.121.195]) by smtp.gmail.com with ESMTPSA id ci10-20020a0566383d8a00b004874d717cffsm3529346jab.29.2024.05.01.12.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 12:54:40 -0700 (PDT) Date: Wed, 1 May 2024 19:54:35 +0000 From: Justin Stitt To: Edward Liaw Cc: linux-kernel@vger.kernel.org, Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , "H. Peter Anvin" , Andy Lutomirski , linux-kselftest@vger.kernel.org, kernel-team@android.com, llvm@lists.linux.dev Subject: Re: [PATCH v3] selftests/vDSO: Explicit unsigned char conversion for elf_hash Message-ID: References: <20240501180622.1676340-1-edliaw@google.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: <20240501180622.1676340-1-edliaw@google.com> Hi, On Wed, May 01, 2024 at 06:06:18PM +0000, Edward Liaw wrote: > Fixes clang compilation warnings by adding explicit unsigned conversion: > > parse_vdso.c:206:22: warning: passing 'const char *' to parameter of > type 'const unsigned char *' converts between pointers to integer types > where one is of the unique plain 'char' type and the other is not > [-Wpointer-sign] > ver_hash = elf_hash(version); > ^~~~~~~ > parse_vdso.c:59:52: note: passing argument to parameter 'name' here > static unsigned long elf_hash(const unsigned char *name) > ^ > parse_vdso.c:207:46: warning: passing 'const char *' to parameter of > type 'const unsigned char *' converts between pointers to integer types > where one is of the unique plain 'char' type and the other is not > [-Wpointer-sign] > ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_info.nbucket]; > ^~~~ > parse_vdso.c:59:52: note: passing argument to parameter 'name' here > static unsigned long elf_hash(const unsigned char *name) > > Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser") > Signed-off-by: Edward Liaw > --- > v2: update commit message with correct compiler warning > v3: fix checkpatch errors and indentation > --- > tools/testing/selftests/vDSO/parse_vdso.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c > index 413f75620a35..9e29ff0657ea 100644 > --- a/tools/testing/selftests/vDSO/parse_vdso.c > +++ b/tools/testing/selftests/vDSO/parse_vdso.c > @@ -203,8 +203,9 @@ void *vdso_sym(const char *version, const char *name) Is it possible to just change the types of the parameters of vdso_sym() or does that trigger even more warnings on the callsites of vdso_sym()? Either way, this looks ok to me. Acked-by: Justin Stitt > if (!vdso_info.valid) > return 0; > > - ver_hash = elf_hash(version); > - ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_info.nbucket]; > + ver_hash = elf_hash((const unsigned char *)version); > + ELF(Word) chain = vdso_info.bucket[ > + elf_hash((const unsigned char *)name) % vdso_info.nbucket]; > > for (; chain != STN_UNDEF; chain = vdso_info.chain[chain]) { > ELF(Sym) *sym = &vdso_info.symtab[chain]; > -- > 2.45.0.rc0.197.gbae5840b3b-goog > Thanks Justin