Message ID | 20210520100528.322846-6-rasmus.villemoes@prevas.dk |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=CVMqawR/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fm54H39dpz9sRf for <incoming@patchwork.ozlabs.org>; Thu, 20 May 2021 20:06:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AE2482E36; Thu, 20 May 2021 12:06:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="CVMqawR/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DDD8B82D36; Thu, 20 May 2021 12:06:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0705.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::705]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 65BA982D1B for <u-boot@lists.denx.de>; Thu, 20 May 2021 12:05:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fYy9xWUKRRi7MhYUSYg+FGjjvJjgvxaOt48OLkEtWjAcSskch9qu1sjkXKpko9qb39QarBWri2+0+c3IWv6dJKKNK538VirwZgRycRi8lrXdqqUHNE48OjQ/YekpMZxk8vkxUdEAKRqrlZxAbvWTRtNpw0wYlx6gKFsK3DFdAfZ4COaNpo2QQ6+7bWjD9onooZU6k88hhua9a9v50KM07pXpOZ7R6sJjXq7D+vPZE/GOFU74h+4T+P0zz73XVL+nq5SZPS1BufjkNiK/DJz3kHO0Hr1g4DEl3MyxAPmCZsHMwBPgbOlLoMJ11YD+MVLXtsEi0LwZJru3xsGy3lXBrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IsRu6WtnihyB++ebNW28UaRFquxNAF4bsFpS/bItQnU=; b=AIPhA5KtroghG3fOMwjocRPJCLs3YTUhxCNcu5JWc5XpQJDNkb8coH9m2pC5N4GDo7sUZ1AZKEKV9te6QCD3f7n/pPixn9hiIcS9CBhJaneEALedD52RrQYRVhWvPiJKtsNyvmksNdDglDoTOIaa4JYTmkfDu8ENmcOdRKLjp/OEfvFtaHDS9APMgDVtBVk7tqlxThSYlgsN0opLPR4HLSnkb2HYXuuSVlOh0VG6T60hTaDrAoJ9GqE67gII6XI3dF5+ewJ6KCjCJ4BgVoHBfs86mVA+36CpeuBKHMVLrshjVMGI5VdTR1oeGhGwG8B34QyPaMI8e0dcXuhypDg9tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IsRu6WtnihyB++ebNW28UaRFquxNAF4bsFpS/bItQnU=; b=CVMqawR/z/4hnOcILJul68hICmIs1Bdi3YW/3/XT+pEHvZrc54rpB8OYqm2By4ObgPEehYLgvqdYvljVvQZB/kltfS1JnfXhr8mOVQs0s+zUk8fKBGBKDnk/GOrF/aKX5BZd6pz+izVle8Wl/VVov/ki5ZrpM0ytvCOZ3JHESRs= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB2417.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:d5::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Thu, 20 May 2021 10:05:52 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::888d:190b:b3b5:1ad2]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::888d:190b:b3b5:1ad2%3]) with mapi id 15.20.4129.028; Thu, 20 May 2021 10:05:52 +0000 From: Rasmus Villemoes <rasmus.villemoes@prevas.dk> To: u-boot@lists.denx.de Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>, Rasmus Villemoes <rasmus.villemoes@prevas.dk> Subject: [PATCH 5/5] common/log.c: use vscnprintf() in log_dispatch() Date: Thu, 20 May 2021 12:05:28 +0200 Message-Id: <20210520100528.322846-6-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210520100528.322846-1-rasmus.villemoes@prevas.dk> References: <20210520100528.322846-1-rasmus.villemoes@prevas.dk> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [80.208.71.248] X-ClientProxiedBy: AM6P194CA0072.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (80.208.71.248) by AM6P194CA0072.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Thu, 20 May 2021 10:05:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb437b61-28b8-4ede-a5ad-08d91b76d9c0 X-MS-TrafficTypeDiagnostic: AM0PR10MB2417: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <AM0PR10MB24171AE6A6EC7E6FA9FB7A24932A9@AM0PR10MB2417.EURPRD10.PROD.OUTLOOK.COM> X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lCKPr3Y2NvK2xYV2ch6iFJmsz1Vh4HR52g3rf9OcOXOFsHcM/9Jnt8OkmLZBl8ovHh4/uJIrjov7EmuhTA7yKSMs/9oBzGxzT30eL1Pet0DZrzHc9A0wOhQXdDL54HsxLCa69t3EhXQLecxMAen4+sTQg0pE035prciPy/LUTL5AIZ+bJ+e05nNofFzyWZUMxuHKAG7q0hAvcwl+mmrjWn6TilKVnLVg/hjb8H3BuCECrspvCGkFT0s9nCAe5pDRl0Qsqbe3rYW8NvfIOoTaGhgb2SSfend1oly12whxaQ2L/kMjHncIGEFhAU6IUsjMyD/b/xbDhL1NdY1ZssvpxB9T52AYYIS26mEAXZqEfAVCPR2jJ/6bZ10nEMGLdzKE3zRikQ2HGoACR02CX9XVNZZ8ywdHFDMsDfuZol5VpJlZWCaE38Ge/fKQJgOik9cpH+WAb7SPtTDfNSHSAiEBGzGdvKUFsr+dhq7mi2hadx2z63vbaMPrUui5GFBkeeyrXyV12ElIB4JhTiM2Kt/LmAAXRIC+GwU2G2JNxOQD9/FhasSR2zE7GFHAlzCrZ3pZtUTJp7Awp9l72wvM5v8OzyJ8LoLw8lbKIXwSAZPhVXbY8rXSR8H3VKYT3W32saUKaaI88x4dvWDRBr0GgeePQ/4uU/ao9n/Uew6y6LGVQSg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(346002)(39850400004)(396003)(376002)(136003)(366004)(478600001)(38100700002)(52116002)(38350700002)(6666004)(956004)(6506007)(5660300002)(6486002)(2616005)(4744005)(26005)(86362001)(44832011)(6916009)(107886003)(1076003)(36756003)(66946007)(54906003)(316002)(6512007)(2906002)(4326008)(83380400001)(8676002)(66556008)(8976002)(186003)(66476007)(8936002)(16526019); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ES5CnEngqu4chR7opjvs2ZEdveY/33+pSHCjpQPEZ/wHnbNN/Asyv99/mu86mLsm5UGDOruSUfncIw3D/kCNWquFjaHJj6Fi8qE+RSeb/9RYMZavBx05DNcph2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LD+HMdVw9/uYinEh4L8Y1uTAtcRb3PhYJDOhd7cCbmNKnW/DeLqHhVm/SvTtpLD49fTwcgQvkth4HrDuWlda0CkApCU18RW7EKwdXeuv+31QHmCpyWcGXo6O7xKavzeZ6BKHNcmUjgGrkX7cA39hwqERvFBUgcgGR X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: bb437b61-28b8-4ede-a5ad-08d91b76d9c0 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2021 10:05:52.5526 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kbswh/lA74kwBqCZynSmgtSFl0ajjsWbMHCxAjOlY0B2d6j1mCz+p10QYo1+cV6LYdvO3gq5fXAwfoEcmT4CYnBE8LnzZI55D0NXjzxlqJ4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2417 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean |
Series |
assorted printf-related patches
|
expand
|
On Thu, 20 May 2021 at 04:05, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote: > > We have to use the *printf variant which returns the strlen() of the > resulting string, not the > how-much-would-have-been-printed-given-enough-space, in order to use > that value to inspect the last character in the string. > > Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> > --- > common/log.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org> But I think it should check for a -ve value too.
diff --git a/common/log.c b/common/log.c index ea407c6db9..cba8df5caa 100644 --- a/common/log.c +++ b/common/log.c @@ -220,7 +220,7 @@ static int log_dispatch(struct log_rec *rec, const char *fmt, va_list args) if (!rec->msg) { int len; - len = vsnprintf(buf, sizeof(buf), fmt, args); + len = vscnprintf(buf, sizeof(buf), fmt, args); rec->msg = buf; gd->log_cont = len && buf[len - 1] != '\n'; }
We have to use the *printf variant which returns the strlen() of the resulting string, not the how-much-would-have-been-printed-given-enough-space, in order to use that value to inspect the last character in the string. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> --- common/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)