Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17D00C52D6F for ; Tue, 27 Aug 2024 03:23:14 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WtCYD6lm7z2yZ0 for ; Tue, 27 Aug 2024 13:23:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=115.124.30.110 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1724728990; cv=none; b=M3uXqrIupFUa075pTM7XZO80/xmssgM7wY/+BcOpfCn3isIpS1t19eoWIH6tkjThtQ5Bb3OqjhcnR00qqh1r/kU0gOu4o3ALvvTzT6xMYiKrz5TnizNuETHToPvUIHVcIHt2Khmdn1rLSI8gNxAeDpqyN8H4xq30f8Yu8JsiMVshpQdw13XRUXMNeXjAtMcUGHyx1+5bjxXHUAY2QsBbqJWvKs6ulR26ELGuW9c+2JSDPJB3dVQFG3YDN7vvApPW5KVqxXL+UZWhujTvEJYRE1FzD71vGVEBx0aXtKupHxPELjWu7s/Eba47GE9Fx83o+tb1TEJGTEZO1BWkEJcbuw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1724728990; c=relaxed/relaxed; bh=RlqcbGoTA3Os/3f34aZcUnV8x+cRIptIbQSZrp+W7Z4=; h=DKIM-Signature:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; b=FEkOJJtfDj37hAgmzblfx8LzJ/VpOjHGtzw5oX3xg8kAUGgpSlzJopKoSuP2tOmQVJqYFr1fV2D4nobvlsNazg2VuKqS7Nui9v9OhfDGFjcNt3ixdza1jozr+UVftmJPGpHPrF2PCqnSF9am/msZXt5JaU/3pOQJqwjYrbWReWQKzsezAI61hh0G6l/QjQ/1xBZiOqIdnF2Tviqvoqx9csyN75EpULpaAR7+gg34Um09LGx1MTbFOS3uFPZxuYKzw8ow2Bkub/bCeJa4CRYi0tYIemnWXIzTIpR4um/gM6+Jyn+zLBzzXggoMFWDajLq661Ao8/9vsk3pSK4h5AP4A== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=Kz5n7H1/; dkim-atps=neutral; spf=pass (client-ip=115.124.30.110; helo=out30-110.freemail.mail.aliyun.com; envelope-from=hongzhen@linux.alibaba.com; receiver=lists.ozlabs.org) smtp.mailfrom=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=Kz5n7H1/; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.110; helo=out30-110.freemail.mail.aliyun.com; envelope-from=hongzhen@linux.alibaba.com; receiver=lists.ozlabs.org) Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4WtCY80sWMz2xfK for ; Tue, 27 Aug 2024 13:23:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1724728981; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=RlqcbGoTA3Os/3f34aZcUnV8x+cRIptIbQSZrp+W7Z4=; b=Kz5n7H1/5HjI2vTPzPWYl/Nz8TmAGkcJaiJbhtPJgHgQRksKJn96UwG8mYm56fcxuAYz2CVx5/OBLW/F7LTbGuesYReKCLAOeYIV/OtWlhAA/4dYMhEdyvYRsBdgKj1WmDc9/34NhQJ2FmHQELQwmos/yeNg8jRgXE4ZJEtui1Y= Received: from localhost(mailfrom:hongzhen@linux.alibaba.com fp:SMTPD_---0WDl2vrm_1724728980) by smtp.aliyun-inc.com; Tue, 27 Aug 2024 11:23:00 +0800 From: Hongzhen Luo To: linux-erofs@lists.ozlabs.org Subject: [PATCH v4] erofs-utils: fix invalid argument type in erofs_err() Date: Tue, 27 Aug 2024 11:22:40 +0800 Message-ID: <20240827032240.1869284-1-hongzhen@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" Coverity-id: 502374, 502367, 502362, 502348, 502342, 502341, 502340, 502358 Fix several issues found by Coverity regarding "Invalid type in argument for printf format specifier". Signed-off-by: Hongzhen Luo --- v4: Changes since v3: Only modify the parts reported by Coverity, while leaving the rest as-is. v3: https://lore.kernel.org/all/20240814045501.1675174-1-hongzhen@linux.alibaba.com/ v2: https://lore.kernel.org/all/20240814033813.1605825-1-hongzhen@linux.alibaba.com/ v1: https://lore.kernel.org/all/20240813121003.780870-1-hongzhen@linux.alibaba.com/ --- fsck/main.c | 4 ++-- lib/blobchunk.c | 3 ++- lib/compress.c | 4 ++-- lib/fragments.c | 10 +++++----- lib/super.c | 3 ++- mkfs/main.c | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/fsck/main.c b/fsck/main.c index 28f1e7e..89d87fb 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -807,8 +807,8 @@ static int erofsfsck_dirent_iter(struct erofs_dir_context *ctx) curr_pos = prev_pos; if (prev_pos + ctx->de_namelen >= PATH_MAX) { - erofs_err("unable to fsck since the path is too long (%u)", - curr_pos + ctx->de_namelen); + erofs_err("unable to fsck since the path is too long (%llu)", + (curr_pos + ctx->de_namelen) | 0ULL); return -EOPNOTSUPP; } diff --git a/lib/blobchunk.c b/lib/blobchunk.c index 2835755..33dadd5 100644 --- a/lib/blobchunk.c +++ b/lib/blobchunk.c @@ -95,7 +95,8 @@ static struct erofs_blobchunk *erofs_blob_getchunk(struct erofs_sb_info *sbi, chunk->device_id = 0; chunk->blkaddr = erofs_blknr(sbi, blkpos); - erofs_dbg("Writing chunk (%u bytes) to %u", chunksize, chunk->blkaddr); + erofs_dbg("Writing chunk (%llu bytes) to %u", chunksize | 0ULL, + chunk->blkaddr); ret = fwrite(buf, chunksize, 1, blobfile); if (ret == 1) { padding = erofs_blkoff(sbi, chunksize); diff --git a/lib/compress.c b/lib/compress.c index 8655e78..17e7112 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -497,8 +497,8 @@ static bool z_erofs_fixup_deduped_fragment(struct z_erofs_compress_sctx *ctx, inode->fragmentoff += inode->fragment_size - newsize; inode->fragment_size = newsize; - erofs_dbg("Reducing fragment size to %u at %llu", - inode->fragment_size, inode->fragmentoff | 0ULL); + erofs_dbg("Reducing fragment size to %llu at %llu", + inode->fragment_size | 0ULL, inode->fragmentoff | 0ULL); /* it's the end */ DBG_BUGON(ctx->tail - ctx->head + ctx->remaining != newsize); diff --git a/lib/fragments.c b/lib/fragments.c index 7591718..bdbd33d 100644 --- a/lib/fragments.c +++ b/lib/fragments.c @@ -138,7 +138,7 @@ static int z_erofs_fragments_dedupe_find(struct erofs_inode *inode, int fd, inode->fragment_size = deduped; inode->fragmentoff = pos; - erofs_dbg("Dedupe %u tail data at %llu", inode->fragment_size, + erofs_dbg("Dedupe %llu tail data at %llu", inode->fragment_size | 0ULL, inode->fragmentoff | 0ULL); out: free(data); @@ -283,8 +283,8 @@ int z_erofs_pack_file_from_fd(struct erofs_inode *inode, int fd, goto out; } - erofs_dbg("Recording %u fragment data at %lu", inode->fragment_size, - inode->fragmentoff); + erofs_dbg("Recording %llu fragment data at %lu", + inode->fragment_size | 0ULL, inode->fragmentoff); if (memblock) rc = z_erofs_fragments_dedupe_insert(memblock, @@ -316,8 +316,8 @@ int z_erofs_pack_fragments(struct erofs_inode *inode, void *data, if (fwrite(data, len, 1, packedfile) != 1) return -EIO; - erofs_dbg("Recording %u fragment data at %lu", inode->fragment_size, - inode->fragmentoff); + erofs_dbg("Recording %llu fragment data at %lu", + inode->fragment_size | 0ULL, inode->fragmentoff); ret = z_erofs_fragments_dedupe_insert(data, len, inode->fragmentoff, tofcrc); diff --git a/lib/super.c b/lib/super.c index 32e10cd..d4cea50 100644 --- a/lib/super.c +++ b/lib/super.c @@ -213,7 +213,8 @@ struct erofs_buffer_head *erofs_reserve_sb(struct erofs_bufmgr *bmgr) bh = erofs_balloc(bmgr, META, 0, 0, 0); if (IS_ERR(bh)) { - erofs_err("failed to allocate super: %s", PTR_ERR(bh)); + erofs_err("failed to allocate super: %s", + erofs_strerror(PTR_ERR(bh))); return bh; } bh->op = &erofs_skip_write_bhops; diff --git a/mkfs/main.c b/mkfs/main.c index b7129eb..1027fc6 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -274,7 +274,7 @@ static int erofs_mkfs_feat_set_fragments(bool en, const char *val, u64 i = strtoull(val, &endptr, 0); if (endptr - val != vallen) { - erofs_err("invalid pcluster size %s for the packed file %s", val); + erofs_err("invalid pcluster size %s for the packed file", val); return -EINVAL; } pclustersize_packed = i; -- 2.43.5