Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp91517rdb; Wed, 14 Feb 2024 13:51:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVORRu2K8XA79oru7Jddw3f4uT/fX+OM3JAVGML6AnPDd5o6iNfyYJRXKrA8cHbV3vD9OrEvYoKOOFqGvsAbVTMMmnYLfod4n64Smt8oQ== X-Google-Smtp-Source: AGHT+IE6pZ6USsDZBcyjUVxmVgKycfv01hJf7ARl0dUllCyzPIfwQVs77tML2VjY65iePGZgyWQR X-Received: by 2002:a17:906:2614:b0:a3c:698:635f with SMTP id h20-20020a170906261400b00a3c0698635fmr2742771ejc.28.1707947478499; Wed, 14 Feb 2024 13:51:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707947478; cv=pass; d=google.com; s=arc-20160816; b=pDphFj0eA2hXo/9WL9bZ9NYo33sYcP13ZGRTl5gwQ8ZzJNWRaDdvOdIMa2ZxlbVo8a vUnufFinwT955JxV/GExWpIgmqz6jd3ypTN7HShvisIrkLG2bDK2ro6S9wVLAmk89GfU E7TsEEVEEsJKpu+eRXmtFkk4dwTDwr9H02MLwI1apzseMTxooWafkii3zOklNqUwP5i5 5BNfsaYLl0g3S53waoCFZkKzzRtU6t9t7vJqQgY0E0jObomIF9OCKaM+jD6hIGNpumPl n+HWckcZgeHiUP4jO1pNvfbz7wnNPy7bKqEhpScA6NqG5zVr8v6wY62LoXuKqFlLOGN4 m/DQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=mi0RSxbVzPWILoZDCU58Qlo5ijNXbWrWoWQ1rQw2zOw=; fh=HaUrxM3fyvvCn0bnjtd/MXVfFU81u1tQ1i7TUojIwBY=; b=0UO9LC2xVjQpe+LlMQSUZ5SwU2/ExVZXoUhLbDF5hFW2th1nWY5jqkbofwy//rdD8Z btqpympvZOkg/SYncEBZnnus743jlhkNxKwtiycirDtmCrJTBPnn2G7Qk6Y24me1w3kJ mceqP2unyWiD/sdBJrrygPZS0bpEd6PUJVHAOaLhzKJIolcUt1AuK5wCAMAmReLZIUwd 5eVFMHepBgyUjKwk0MDNug3GmbOUVQ6IKIpImwZ121iCQDrwCe5FTPqzIRxMBHsq8m0V beinmjFEwwIjvpjTsA5mZ2zmP2XPIJ5k+dWiOh166skSTMxV0l06ZI6/nI9T7YQdm2P/ u8VA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=nm7swkuF; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-66000-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66000-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWqjcMFPt2FFOI9Bv+RZ6blnURn4JV1kABvmsOcsGxeYfwA/jV/36++QhPwbOlDTV/cbpoZQsIEnMabFKHtP4wr3VMmb73CflGt/as1cg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y7-20020a170906558700b00a3d72668ae2si364955ejp.1023.2024.02.14.13.51.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 13:51:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66000-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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=nm7swkuF; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-66000-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66000-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A52E81F2A54E for ; Wed, 14 Feb 2024 21:43:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3C4D141987; Wed, 14 Feb 2024 21:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="nm7swkuF" Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 9536E13F003 for ; Wed, 14 Feb 2024 21:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707947009; cv=none; b=u3HSDb5TOffrLxmtyjr2DmckkbYygEO1Fv7d2A+euTurwpE7Y6/1vYuRMvFevgFxwN+37gxWd9+SNndGcSxCO4HJ1CQCxlfcRUTrW814/ycwXhfkJwVt+iaskTXyhILK/dMSEk13k0VckMGu8iiGzifnBZUPNJC+IiNfGYL3lnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707947009; c=relaxed/simple; bh=NNXekux/WHD+IAyfhhTztt1QcH5aqOmbij+qdO9nKoo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VHmMfUEuPXOf/01dPuOTJQ1ch5Q+X1Cw+CyYUdnMJHTilUig5kD8VLp+cADw32diVFFVjP0BIJlTXAfY0NL9IlourjcRKdrYIiVDv4OBN389GkjXDFH11SuoezYa1iLPumkP25u1UYIIpCWOdR7/EoRKlIfJ7PmSO+pn+0pjUFs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=nm7swkuF; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d8aadc624dso1791075ad.0 for ; Wed, 14 Feb 2024 13:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1707947007; x=1708551807; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mi0RSxbVzPWILoZDCU58Qlo5ijNXbWrWoWQ1rQw2zOw=; b=nm7swkuF1UsKWdAx6Bba6gPCMoBEsN+Mrhh38dneKPpRtuErjIRf3YrvxgoBh0oTJ+ s/IajnWcQxwLjCHxYD59gxkWvOicl4KtFSb7b7GQi7BmfTHiifVDP3dtzDhHAUVHXIvY Rqvi0xJrKJr8q9VxRkvAY0CpNdxdkK7tEyP2lkFYFy6xEJ58u6aK2i0AlXb9vXnbgwdZ 7Ou4/VuDMrWikredjXzOeBQewhLBk5QKiUrVNQ3PxCzXqG4ce3C03Rm5mW92Hkly7VGK zrfXuBVWGqv1Knx8HAvjC30xhy2LXajTPGYXyPIoa32lRJPShgRxnDPdVZdA9G57xjSX 7kWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707947007; x=1708551807; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mi0RSxbVzPWILoZDCU58Qlo5ijNXbWrWoWQ1rQw2zOw=; b=WrZzmh7/FwJitkZF0RfymEm8drZnAq/UPvGivlgHcGs1vMJ2Jw/58s+oIvfxIFDVKR ye5TXLKzsp+p+jemyanDvM8Ti3Nj2UKQFrqzGKxUM2uk3t+E2XLpdbhTdRTSW1s03Tj1 wOasoJRmnRfBmKbs7WXu1gbMcxiaus5q7E710QgJwDsKlQahPb4qBDJb+HXZVfZBA2Ie GgSF8JIocrFvpsZgnGTzmQHTsZntoh+cJja3K0PquC8EuE6ISFrk4gwyF5FON6Se3GX0 2C+87PBOmUzbbyD8x+iB9ZF60R1L2oG+wC+LwntlJ1NMjbypHsq3nuhdT4FkM3hF4Ins y17w== X-Gm-Message-State: AOJu0YyR4dN3NSv/Ty11mSkPn3MZeijAdUGr1/HUgrJ8qcRJb/GDzwfu l/1pwHXHPDtbnYCJFYIXIyuUJskUDerf15a2T3UpOkynm2W9FIxUmXrM06hxyPNBblRkr3ygMqc C X-Received: by 2002:a17:902:8216:b0:1d9:a527:608f with SMTP id x22-20020a170902821600b001d9a527608fmr3512091pln.64.1707947007120; Wed, 14 Feb 2024 13:43:27 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVo12LYd6ieKErNtgxTOLGkgHw0QC7rZe1zK0oXsMePJhakxO4ZyymTg5yu3EDLatU58Kh/0uXFaimx/rcO8kmW/Y3/V5UReHIDJqZ07QSHfSJ84oqWOU7KDDvXWaLvz15UdM/2rR2hTzGHC48qoRZYEmt5njsyGQngVFLm4iNT4oIjLzRjE5EHsNQF1TxuhieQZ0IMbZ3lHbbQ0JhLk2afaW0+BXBqGSdnFZBSdt3uNoQVYDsrAjyMw8HLizXqMnes0ebqHYKzf+vReIZpOxlDsJxoQay5t0/suGZY0UfhJvKn3Sa49xOSNvXE8QvNH94YXtYdciWDs6QdNCZTZfvuj+iokhoE7ag= Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id o17-20020a170902e01100b001db6739d337sm1085919plo.163.2024.02.14.13.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 13:43:26 -0800 (PST) From: Charlie Jenkins Date: Wed, 14 Feb 2024 13:41:02 -0800 Subject: [PATCH v8 1/2] lib: checksum: Fix type casting in checksum kunits 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-Transfer-Encoding: 7bit Message-Id: <20240214-fix_sparse_errors_checksum_tests-v8-1-36b60e673593@rivosinc.com> References: <20240214-fix_sparse_errors_checksum_tests-v8-0-36b60e673593@rivosinc.com> In-Reply-To: <20240214-fix_sparse_errors_checksum_tests-v8-0-36b60e673593@rivosinc.com> To: Guenter Roeck , David Laight , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Al Viro Cc: linux-kernel@vger.kernel.org, Charlie Jenkins , kernel test robot X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707947004; l=2493; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=NNXekux/WHD+IAyfhhTztt1QcH5aqOmbij+qdO9nKoo=; b=gR/M6E/C4g3VNUt1MpGkVNoeJgadk6hnf40hfs7jMtK5fzMzPe09JAiabGlB5dMVNYOw1HDpu eKlEAfgJsJ1Al2bzCRmRNHUD6+ETTUWYyhjiudF1OT1jRZiefDGsbn+ X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= The checksum functions use the types __wsum and __sum16. These need to be explicitly casted to, because will cause sparse errors otherwise. Fixes: 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202401200106.PMTn6g56-lkp@intel.com/ Signed-off-by: Charlie Jenkins Tested-by: Guenter Roeck --- lib/checksum_kunit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c index 225bb7701460..776ad3d6d5a1 100644 --- a/lib/checksum_kunit.c +++ b/lib/checksum_kunit.c @@ -215,7 +215,7 @@ static const u32 init_sums_no_overflow[] = { 0xffff0000, 0xfffffffb, }; -static const __sum16 expected_csum_ipv6_magic[] = { +static const u16 expected_csum_ipv6_magic[] = { 0x18d4, 0x3085, 0x2e4b, 0xd9f4, 0xbdc8, 0x78f, 0x1034, 0x8422, 0x6fc0, 0xd2f6, 0xbeb5, 0x9d3, 0x7e2a, 0x312e, 0x778e, 0xc1bb, 0x7cf2, 0x9d1e, 0xca21, 0xf3ff, 0x7569, 0xb02e, 0xca86, 0x7e76, 0x4539, 0x45e3, 0xf28d, @@ -241,7 +241,7 @@ static const __sum16 expected_csum_ipv6_magic[] = { 0x3845, 0x1014 }; -static const __sum16 expected_fast_csum[] = { +static const u16 expected_fast_csum[] = { 0xda83, 0x45da, 0x4f46, 0x4e4f, 0x34e, 0xe902, 0xa5e9, 0x87a5, 0x7187, 0x5671, 0xf556, 0x6df5, 0x816d, 0x8f81, 0xbb8f, 0xfbba, 0x5afb, 0xbe5a, 0xedbe, 0xabee, 0x6aac, 0xe6b, 0xea0d, 0x67ea, 0x7e68, 0x8a7e, 0x6f8a, @@ -582,7 +582,7 @@ static void test_ip_fast_csum(struct kunit *test) for (int len = IPv4_MIN_WORDS; len < IPv4_MAX_WORDS; len++) { for (int index = 0; index < NUM_IP_FAST_CSUM_TESTS; index++) { csum_result = ip_fast_csum(random_buf + index, len); - expected = + expected = (__force __sum16) expected_fast_csum[(len - IPv4_MIN_WORDS) * NUM_IP_FAST_CSUM_TESTS + index]; @@ -614,8 +614,9 @@ static void test_csum_ipv6_magic(struct kunit *test) len = *(unsigned int *)(random_buf + i + len_offset); proto = *(random_buf + i + proto_offset); csum = *(unsigned int *)(random_buf + i + csum_offset); - CHECK_EQ(expected_csum_ipv6_magic[i], - csum_ipv6_magic(saddr, daddr, len, proto, csum)); + CHECK_EQ((__force __sum16)expected_csum_ipv6_magic[i], + csum_ipv6_magic(saddr, daddr, len, proto, + (__force __wsum)csum)); } #endif /* !CONFIG_NET */ } -- 2.43.0