Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Bill O'Donnell <bodonnel@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: cmaiolino@redhat.com, Bill O'Donnell <bodonnel@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	"Darrick J . Wong" <djwong@kernel.org>
Subject: [PATCH v3 1/4] mkfs.xfs: avoid potential overflowing expression in xfs_mkfs.c
Date: Fri, 14 Jun 2024 11:00:13 -0500	[thread overview]
Message-ID: <20240614160643.1879156-2-bodonnel@redhat.com> (raw)
In-Reply-To: <20240614160643.1879156-1-bodonnel@redhat.com>

Cast max_tx_bytes to uint64_t to avoid overflowing expression in
calc_concurrency_logblocks().

Coverity-id: 1596603

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 mkfs/xfs_mkfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index f4a9bf20..2f801dd4 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3678,7 +3678,7 @@ calc_concurrency_logblocks(
 	 * without blocking for space.  Increase the figure by 50% so that
 	 * background threads can also run.
 	 */
-	log_bytes = max_tx_bytes * 3 * cli->log_concurrency / 2;
+	log_bytes = (uint64_t)max_tx_bytes * 3 * cli->log_concurrency / 2;
 	new_logblocks = min(XFS_MAX_LOG_BYTES >> cfg->blocklog,
 				log_bytes >> cfg->blocklog);
 
-- 
2.45.2


  reply	other threads:[~2024-06-14 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 16:00 [PATCH v3 0/4] xfsprogs: coverity fixes Bill O'Donnell
2024-06-14 16:00 ` Bill O'Donnell [this message]
2024-06-14 16:00 ` [PATCH v3 2/4] xfs_db: fix unitialized automatic struct ifake to 0 Bill O'Donnell
2024-06-14 16:00 ` [PATCH v3 3/4] xfs_fsr: correct type in fsrprintf() call Bill O'Donnell
2024-06-14 16:46   ` Christoph Hellwig
2024-06-14 17:24   ` Darrick J. Wong
2024-06-14 16:00 ` [PATCH v3 4/4] xfs_repair: correct type of variable global_msgs.interval to time_t Bill O'Donnell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614160643.1879156-2-bodonnel@redhat.com \
    --to=bodonnel@redhat.com \
    --cc=cmaiolino@redhat.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox