Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2110501lqo; Sun, 19 May 2024 14:07:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbUcu3vXwXnCmCiUARXAE72sGdo4bYzjODIPJje5a+eHdAWb7p1h5vcuWDSOgYc5IbfaV7ckeNuBpgx9czLpf/k1RDLMblRwvpNqJkgg== X-Google-Smtp-Source: AGHT+IFgvB1Zg7nSAFH3qe6JuUWAw88c/TZg7giDYsaPEoNBcsEjxk4X8PaN3tGcDCy/GorhPqdH X-Received: by 2002:a05:622a:412:b0:43c:7444:d69c with SMTP id d75a77b69052e-43dfdaac4bamr268006331cf.20.1716152879366; Sun, 19 May 2024 14:07:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716152879; cv=pass; d=google.com; s=arc-20160816; b=f6i/KwaF5FjbttCPHBZWgQshuVOmdtQfCfjCDauwx/BlQQkoGn4j21IT7sodiujFVz yDI6Wa1I9vcURRyB5MPxZVmbHkmQ+rv9IOxMWF/8IvAp1wy5rm60C3xFfPhDsuX1jGAl iRQCpfnbvwhA59NnaNUnP04py5PJSMuysgziovIfW21/26tBdOjJ9fmnbADUVE2IkilL KksAykrCsgzv63AANUhNWFwukEVVEJ/qmGISrIIYFea0wx8YU/pevojZiPLy93jUH7MN PAuKZM0GvTh+UHcCgGqU7BsslToyxfQNyqXtO10nMi0ETa5Y7vYQWNKocckqCS6I3QIc SCVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=MIOv9ARtJnrsAiyvqrHssQMb+LkaeImvV1cTZs300Gw=; fh=tsocq7ODDI2K5sHsKjOZyFZsWdZs05bzf8RddiZ4pFk=; b=An3lAhGfqzWgXzzKxvc1b78QTgMh0l3ZFLXuypU1sVyTwlVfl9ESJpGyjuRoE4LHjC +/86YHGdkDpnPMF5fm7sG29aSv5T9/lpnuY7WhOo8B329nhCbrqper2yDA0ZtgfakFCm /Krn4xyVkoqrw6M5mX/5pun5QujCZB2vacWtY6tYZlmQDY8MLKSxIyg231fiTimofbQD AolV4Uonq1AOmUWN1ccF87J5jdy/1xw0Csdu6D3aow8BIZpaGQaqMyecCQehWQa8wQxw o7G3l2AOWUCfsWkfZGcNMRpddIw2UbzZRwkZjEMeTxgysyxz09bABWIuf7QWpx6LII0k JZGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qaOy4dM7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-183269-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183269-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. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43e104faf94si180811921cf.523.2024.05.19.14.07.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 14:07:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183269-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qaOy4dM7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-183269-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183269-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 1D8591C20444 for ; Sun, 19 May 2024 21:07:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8EBA6EB41; Sun, 19 May 2024 21:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qaOy4dM7" 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 0164D26AEC; Sun, 19 May 2024 21:07:49 +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=1716152870; cv=none; b=OA91khVxx2iPgud07Yr7lEzh50zKWrGYbx08qWHihroYBHw3Nnsrw3o3aCzjfj60a/5yq+6reqBQ7bk/P3LIdkBUhcZa/ybBvbHc8sANsQsUdbtjooonShl/R2DXvoKNFzo/bA4OWiCeNEkMnSbcOGRq148lZwGM4ETCkdDh4MI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716152870; c=relaxed/simple; bh=H6awbG9maNnvIwZjWXp+MfoENhflzFD1z6syx90vt8w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=q7l2UdMu39nWvu9yikfDPoPHQn6VVZGeKxFET11MJLwbO7xb7a0OAwnYaTEPk4rcFotLAaiU4qk7C1FDWQXUOwdByhN8Jui+2AWbWe0nK4r7M2HyOBzcHQUUL57y4nBckyBV693WLmpEhbQu6zl/GLuqkDceTG6OdAUJrS/evCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qaOy4dM7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6337EC32781; Sun, 19 May 2024 21:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716152869; bh=H6awbG9maNnvIwZjWXp+MfoENhflzFD1z6syx90vt8w=; h=From:To:Cc:Subject:Date:From; b=qaOy4dM7+RG6NzPTly9gDrivijI3h0waUvmosPNvNuSdulFOz1xGW0pqAraNLq4Hh my7NuhTeOUrobIr8/Qq2elov23GnsoRTnSE9gDsR0FJ7KdwDD1Nm5m9A2SOLJ0WPEi 6W/0clmDW3ClOolRUmQ8kypF7MUWH2vjUj0Ch/xHz1CpUMaYvAEz2BF1Isw1otp2CF HjF0dpgYySEzVVHaurEOOs88nYPkh3NeGE0zFuOMyd3neD5NyQjz39o7CCn9MtOGiW AYTCznAIxHHyJsitG7gv0BoOJpPlE4lgr4QJiXvCnv3wGckErPfuM0iXADtyC1mB0o RIYq4zzdeBd/A== From: Miguel Ojeda To: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Danilo Krummrich Subject: [PATCH] rust: avoid unused import warning in `rusttest` Date: Sun, 19 May 2024 23:07:35 +0200 Message-ID: <20240519210735.587323-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When compiling for the `rusttest` target, the `core::ptr` import is unused since its only use happens in the `reserve()` method which is not compiled in that target: warning: unused import: `core::ptr` --> rust/kernel/alloc/vec_ext.rs:7:5 | 7 | use core::ptr; | ^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default Thus clean it. Fixes: 97ab3e8eec0c ("rust: alloc: fix dangling pointer in VecExt::reserve()") Signed-off-by: Miguel Ojeda --- rust/kernel/alloc/vec_ext.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust/kernel/alloc/vec_ext.rs b/rust/kernel/alloc/vec_ext.rs index e9a81052728a..1297a4be32e8 100644 --- a/rust/kernel/alloc/vec_ext.rs +++ b/rust/kernel/alloc/vec_ext.rs @@ -4,7 +4,6 @@ use super::{AllocError, Flags}; use alloc::vec::Vec; -use core::ptr; /// Extensions to [`Vec`]. pub trait VecExt: Sized { @@ -141,7 +140,11 @@ fn reserve(&mut self, additional: usize, flags: Flags) -> Result<(), AllocError> // `krealloc_aligned`. A `Vec`'s `ptr` value is not guaranteed to be NULL and might be // dangling after being created with `Vec::new`. Instead, we can rely on `Vec`'s capacity // to be zero if no memory has been allocated yet. - let ptr = if cap == 0 { ptr::null_mut() } else { old_ptr }; + let ptr = if cap == 0 { + core::ptr::null_mut() + } else { + old_ptr + }; // SAFETY: `ptr` is valid because it's either NULL or comes from a previous call to // `krealloc_aligned`. We also verified that the type is not a ZST. base-commit: 97ab3e8eec0ce79d9e265e6c9e4c480492180409 -- 2.45.1