Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2093441ybb; Sat, 4 Apr 2020 21:58:22 -0700 (PDT) X-Google-Smtp-Source: APiQypLMlmvnCAEfPvz9rPTiKt4KOvPE1engPtGAoAyKc3OGGTtThME/+jQmt26zh33zOODWVwFC X-Received: by 2002:a05:6830:d2:: with SMTP id x18mr13020555oto.273.1586062702666; Sat, 04 Apr 2020 21:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586062702; cv=none; d=google.com; s=arc-20160816; b=lLvJUDoyhNDKuD1AbwUY1oAiH/nK9AAc+w8J26k/cZ+hqP5dimsmb7mDZ46Khc7AvF oC54LI+BqBSy345ZxTUlFvAVJzp9bysY1tB7kCyyH37ZtekHAN3DM+jNQEqij8+n9Uzf FWbTwcDZ8K7DgoZUXfDmT+RvetdoqJ60Q1jLpjGQmrpJSEE8KjNXtA4xhQBr5kWXyl4c 3oEeZ1ulion5gxic8wBYYL5axs8yG7RB/Wfz69O32+3nXPGdpJtealUgfVHMAKtJm8+w ObUcaQlcyf7FzdCzxcBoUpM7xmEP2TUErlugdCHvETJV0X0aQW/qPuHHimoQWvziR/Q0 8fgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=i8gQeGNDkB+ERKJN8tgzWDwu8rNNZn41Iteab0ATdJc=; b=IXMPRQ34Ir1L1b2ZGhp2TUD6gaPNoiNZp9GZeiwoYaxoFUqXAE97TlWcrgH7I/stBq PcNUkHB5dg7ldOhjgCryH7OeAkd1mnoiidkCYdI3vF3LdLE04umLI+1kdxgtPoQwtGv5 NbeOJ+RtnARjbvWDCcfRiFOdesDL8esZF5p5BMYPwVd+Da2ulIabbxzFawPWHbv3Kw+K 70eaLNrbaIEEcMpW6qyLeP14wWHXe+IicFU9Mbc8/nlJAZv8hSp9P5g82/S0UFy6u2YY 6pW4T9eS2wW14xLmGLq3vEMHYjTGAU/IqSIjxmOWLtGswN1/Y4QkAm+V0oXvTO5HiK2h F9hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mforney-org.20150623.gappssmtp.com header.s=20150623 header.b=oJL6E5io; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si5895042oic.186.2020.04.04.21.57.52; Sat, 04 Apr 2020 21:58:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@mforney-org.20150623.gappssmtp.com header.s=20150623 header.b=oJL6E5io; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726046AbgDEEy5 (ORCPT + 99 others); Sun, 5 Apr 2020 00:54:57 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:53245 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgDEEy4 (ORCPT ); Sun, 5 Apr 2020 00:54:56 -0400 Received: by mail-pj1-f65.google.com with SMTP id ng8so5005621pjb.2 for ; Sat, 04 Apr 2020 21:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=i8gQeGNDkB+ERKJN8tgzWDwu8rNNZn41Iteab0ATdJc=; b=oJL6E5io6qalYVkcLyagDGske1YtuiLixLxFLw5B+ZlZ7TEghPvO8t7W+3I1PiOOrL M+v6oYay8CLlA+/wHYtfhO0Q4GSLJNJYgbxr0DbW1KgUrU2Sfhv6eyV+FUsxV2fc7BCu eZV75WnTd/lH4uMFFweNFFADMx3kgkuhPL7SKP7WQeI30ckZN0Tghawj4uygr89acg1L 8nDNS8G7mMMxmkp1R3i5WINZAUx2ZExYjVE2unIb2tXKHcpx0ihoTLIBiW6+dHzVrgqZ xpQ/RS/RptaojnGWN6Lz4umwTquzGpwt852e+VFjIn/5OMcIa8Hy6VixE5eoXzSjsQPW c1CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=i8gQeGNDkB+ERKJN8tgzWDwu8rNNZn41Iteab0ATdJc=; b=GFmHqt8QsihTTI3JXQJOh99crrU14PfZeqh9rYZLSxh4x4rCGfmlHKsLHraMWRHYZM MuLQWVBRoNfZZFgyKMYuqH813aGuH3YTFGtAiNev1R3Bsw6sQGhq8/UumA9zTmmK7s3c ugNMj/6aC2BiXfBhYkUu+q94HrYHer/vPQj5XmmTuWHSsBDOV+N6nAZynCHwmwjUQ004 UqBLVkANKAtfffuppZAusaZYBKSYarm43rlc/LNT7tbgvFF2OfskstEslITffB+rMcBl 0165bAKG0npfVcTYVVSQVGPjTYT0facFedlEbG6tqCAQDkH7Tr1Ue6YmkeUiGwNb7YBe uUUA== X-Gm-Message-State: AGi0PuZGnf/ZwixXyuf3kZ1rAj2/8hUFgNmhGKEXnJxKtX1NpE9Na4KF igi1jFc3mssKJijCGrh4QeWn44J4mGk= X-Received: by 2002:a17:90a:d0c3:: with SMTP id y3mr19375193pjw.128.1586062495682; Sat, 04 Apr 2020 21:54:55 -0700 (PDT) Received: from localhost (c-73-70-188-119.hsd1.ca.comcast.net. [73.70.188.119]) by smtp.gmail.com with ESMTPSA id j1sm8714883pfg.64.2020.04.04.21.54.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Apr 2020 21:54:54 -0700 (PDT) From: Michael Forney To: linux-ext4@vger.kernel.org Subject: [PATCH] libext2fs: avoid pointer arithmetic on `void *` Date: Sat, 4 Apr 2020 21:53:46 -0700 Message-Id: <20200405045346.21860-1-mforney@mforney.org> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The pointer operand to the binary `+` operator must be to a complete object type. Signed-off-by: Michael Forney --- lib/ext2fs/csum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c index 8513d1ab..c2550365 100644 --- a/lib/ext2fs/csum.c +++ b/lib/ext2fs/csum.c @@ -274,7 +274,7 @@ static errcode_t __get_dirent_tail(ext2_filsys fs, rec_len = translate(d->rec_len); } - if ((void *)d > ((void *)dirent + fs->blocksize)) + if ((char *)d > ((char *)dirent + fs->blocksize)) return EXT2_ET_DIR_CORRUPTED; if (d != top) return EXT2_ET_DIR_NO_SPACE_FOR_CSUM; -- 2.26.0