| Message ID | 20260316183050.3855921-4-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685874; bh=Gm0CzT+zx36Pyr2HB20Tt59bMjICL1I+CXfO5x1lQ3o=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jjpCe/cLfarTTE/Hnn/eFE+aycb6obZ/SWFDa1HXrv2PdQmXgF4DMpWGbr7k57Xkm fcIjnEGRFbr9DS4mveV2vZ6XFcDMjguyt2+39OOjEFTD+kcQVRtsnFdEgqZixWh+1S sVlGCmCOIRZ1icrR2eztZdCkUTev1A5BXo0ysCarqPRM/i5ZmoOQ+uh8oUQg9HKeri bVoDwjWTXLTeMgHerDyQJDi30HiVP7jb6cI6+AkiKVaHitdUhYRWlxke0cJtugHYUW GWlBgReVD5jANjPZEoyMjUsTOxk0cDxhtX3aPuTd1fXYjeMtyG95yVTYqLGNDlJu/t wsrSfhOfIPYuA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD03C6A078 for <u-boot-concept@u-boot.org>; Mon, 16 Mar 2026 12:31:14 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id P9Ml0BAUOHGT for <u-boot-concept@u-boot.org>; Mon, 16 Mar 2026 12:31:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685874; bh=Gm0CzT+zx36Pyr2HB20Tt59bMjICL1I+CXfO5x1lQ3o=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jjpCe/cLfarTTE/Hnn/eFE+aycb6obZ/SWFDa1HXrv2PdQmXgF4DMpWGbr7k57Xkm fcIjnEGRFbr9DS4mveV2vZ6XFcDMjguyt2+39OOjEFTD+kcQVRtsnFdEgqZixWh+1S sVlGCmCOIRZ1icrR2eztZdCkUTev1A5BXo0ysCarqPRM/i5ZmoOQ+uh8oUQg9HKeri bVoDwjWTXLTeMgHerDyQJDi30HiVP7jb6cI6+AkiKVaHitdUhYRWlxke0cJtugHYUW GWlBgReVD5jANjPZEoyMjUsTOxk0cDxhtX3aPuTd1fXYjeMtyG95yVTYqLGNDlJu/t wsrSfhOfIPYuA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C9C446A07B for <u-boot-concept@u-boot.org>; Mon, 16 Mar 2026 12:31:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685872; bh=5fZh4pUBa+Q2ViQ2iuTCTQqXLjLbAuXNyez8i0I+YlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PpCGe/GAjatH4iv6pk8aIUWmpOelKnsar7otCzxxy9f8iWIOX/82GJPDwdUcueWUB s6Z5/Zi62/aZiLZLmCzmP+HfVVdoss01QTxHemIvk2hblrMnq0PihjW3XXyGKGyLz1 rxDV8cJi3YS0efPeMjpyn87jNLfk9CRQ27oZxsMzHE+Oox/ggT/5U5AabDMEezaqDn enSern9NvudmsrlTc6cIQwuQqMJg9fWllxbreQm26E1wnctW08SY6K0O3kY4s8jP0v Bzc7N7sXswOA1LQbrkEiOSt3qJPfH8sDrGjoNZXeMcyh6XE7kKcZh7hct7pouX43LZ SoBIuyfBD1jTw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 52A246A09F; Mon, 16 Mar 2026 12:31:12 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id VbQZIySNXl_e; Mon, 16 Mar 2026 12:31:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685870; bh=TsDjYSkRfxV9BtS/t/KGBmq9AdKfo8lYoPC5dcVjq40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dE4dzYxkdYiItmMx8r2ZBIz2vQrAXoDF9Ldip47alXNDto/L5XhiSpEDlM8NSMfmK yAdCUiCxB/Q4Xbo8RkEuwr2Xk4DkVsOFFTJW9BmjQMrIusfOc5mFBWWbliDEx0eWKW kJXNz8340RI2D9ND1WHE+HPVcSnKaMO5bF5C40pBudwskkskWIAy6tmE1pQ94Ot4sa NfXEt3pJyXi2uZUhe2q/VxhHcLglN69mWNXJKdpFUUeO51WgmKMqLSLyN2ycQQ8ceg XB6xBryj9/QqFMsgDKVP6yUcBkrX7cPQJDtBAh+/ZuLzD6KtJyWmaxF4IIgH09jWe4 TtXReMsMS4p4A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 73A816A07B; Mon, 16 Mar 2026 12:31:10 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Mon, 16 Mar 2026 12:30:26 -0600 Message-ID: <20260316183050.3855921-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260316183050.3855921-1-sjg@u-boot.org> References: <20260316183050.3855921-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZSGDDYPV5PU5EI3VB4IQDE2IIIDVTXTK X-Message-ID-Hash: ZSGDDYPV5PU5EI3VB4IQDE2IIIDVTXTK X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/17] sandbox: Return -ENOMEM when os_map_file() fails List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/ZSGDDYPV5PU5EI3VB4IQDE2IIIDVTXTK/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
Add automatic memory-leak detection to U-Boot tests
|
|
Commit Message
Simon Glass
March 16, 2026, 6:30 p.m. UTC
From: Simon Glass <sjg@chromium.org> os_map_file() returns -EPERM for all mmap() failures regardless of the actual errno. When mmap() fails with ENOMEM, return -ENOMEM so that callers can distinguish out-of-memory from other errors. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 142b685e031..c1381775b1b 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -299,7 +299,7 @@ int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep) ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, 0); if (ptr == MAP_FAILED) { printf("Can't map file '%s': %s\n", pathname, strerror(errno)); - ret = -EPERM; + ret = errno == ENOMEM ? -ENOMEM : -EPERM; goto out; }