From nobody Fri Nov 22 11:09:15 2024 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 2155F18FDD5 for ; Sat, 16 Nov 2024 08:11:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731744672; cv=none; b=VYaSZCcgSowT6yUpN+tbFvVY8kIOVwP4qiRjs02H5Zw1ARqUxlhyv5jCOEZvIYHduv/jTVnFer8bY/213K8TeZPy0OfIsu+2BDtrcwP186ocGkadGcfVQpowgdewLhu/eS3VjmsJuxzMsjTwYQygG8Q90/ffwJ4E75TwxoXjths= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731744672; c=relaxed/simple; bh=I5d6xq8yApFLD3lqBQul4LMzk21YrsqnImFrxksSgCM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VmTqCPnDpdXjn2nTC5u5wI5Ihs/3WY/5yccoMPUwOn+hejN5LVkjEbY6Dvc08yq8zWop7lFj0oknx0kGfryvBOSNcCpxXRT4y1hFQXlUjg2GSdkvRFICTWVuUG9Z2evE9rRcmXSOc6h6Cep52gZ/uhAm2objXL/EKOn1eNjzjVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=furiosa.ai; spf=none smtp.mailfrom=furiosa.ai; dkim=pass (2048-bit key) header.d=furiosa-ai.20230601.gappssmtp.com header.i=@furiosa-ai.20230601.gappssmtp.com header.b=ns0BAJ6L; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=furiosa.ai Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=furiosa.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=furiosa-ai.20230601.gappssmtp.com header.i=@furiosa-ai.20230601.gappssmtp.com header.b="ns0BAJ6L" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7ee6edc47abso331433a12.3 for ; Sat, 16 Nov 2024 00:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=furiosa-ai.20230601.gappssmtp.com; s=20230601; t=1731744670; x=1732349470; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=96+ITd4Yn9GceeD6WwWI1juRk5f17FxOFIRFnl0ul0k=; b=ns0BAJ6LhrQ+QXzoKO1fuDfYAfkqdLKT1RchI2RjJeetwET4vKDe1mBXdr4diTnBRL /Ya9frbJDr9sjB//OPU+aPZ8ZfgPSKIUfR3nf48RfMKhxA/jn0waEYVzuo60HC0UyGHh wrOUPD4ZK1gNsCcYJs8Tbc8oV3NT99hX0TMQLT/848qilMEHvW1N+hENCs9KhjA29jln Vrlhs0+IYAyCBkcqk1xBCT/eABsI+Ro1eOU1XTEI35MrH5ueOChGQo1BhxfIviM76NjK lj+tR1w4mRpEkwpBJRco7bj0AF/W9R1iCuBaubG2z3A6d2rql6uyek5xV/J4TLTiODM1 dVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731744670; x=1732349470; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=96+ITd4Yn9GceeD6WwWI1juRk5f17FxOFIRFnl0ul0k=; b=iXO5Z8c8a80TKiU8g9MatCL2lQOQHc79rayux28uzYyaW5xHMqdw4h7GAQDl6ZFMS0 0RGMF5x8rGeiVqQUWCzw2Boj2a3wh8O47Y/a+l5VdGo9/VDo+bG5fDS/QOspKQ0+8SiS fY0UN/MTPs0iX+gednsy/qkH38YCskpmu+WyGz7OKeEQ/RBR4IQplo8Re/AAVFYcUWw9 zySUQutnOqhADKd19dd45CR1+rn25EBbTyRgs5+cBSqziD4X9bkzs5+FbnIeLRlCp6/2 hqDycf/azS4w6dKel+TWgrsBaL+9ikxabInN5pm6pJiPPaKZh7ZgOZRD5UMPyxSx0HgU blhw== X-Forwarded-Encrypted: i=1; AJvYcCVqHsE+3R407gyP9gGSJdk8u5TQDkWaVHx0QifiEaVkXH0KnVrOTmNOAH7Lfa2IFQE8ZW/qxF6HsRKdQXs=@vger.kernel.org X-Gm-Message-State: AOJu0YxZCk0VFTn8Vr04nmpppzie0+OJ1b5qcHZZa9HAn3rgXFgLphVt HUiWSXvfPxopFs3wWVKaBd0+lKF541RSAr1z+3WIKNv9FocGXfvSrv/mquUV9DQ= X-Google-Smtp-Source: AGHT+IEbav/q6nbtcpi6jdgXPqNXxpTkVa7JXKPtww5C9bR4QElLwnA5phd49NQB6khRf9cPHWGSBg== X-Received: by 2002:a17:902:ecca:b0:211:ce94:866a with SMTP id d9443c01a7336-211d0ebf214mr78997325ad.40.1731744670439; Sat, 16 Nov 2024 00:11:10 -0800 (PST) Received: from localhost.localdomain ([61.83.209.48]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211eca09906sm8106475ad.246.2024.11.16.00.11.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 16 Nov 2024 00:11:10 -0800 (PST) From: Sidong Yang To: Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Andrii Nakryiko , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sidong Yang Subject: [PATCH] libbpf: Change hash_combine parameters from long to unsigned long Date: Sat, 16 Nov 2024 17:10:52 +0900 Message-ID: <20241116081054.65195-1-sidong.yang@furiosa.ai> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The hash_combine() could be trapped when compiled with sanitizer like "zig = cc" or clang with signed-integer-overflow option. This patch parameters and ret= urn type to unsigned long to remove the potential overflow. Signed-off-by: Sidong Yang Acked-by: Yonghong Song --- tools/lib/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 8befb8103e32..12468ae0d573 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -3548,7 +3548,7 @@ struct btf_dedup { struct strset *strs_set; }; =20 -static long hash_combine(long h, long value) +static unsigned long hash_combine(unsigned long h, unsigned long value) { return h * 31 + value; } --=20 2.42.0