* [PATCH] libext2fs: avoid pointer arithmetic on `void *`
@ 2020-04-05 4:53 Michael Forney
2020-04-06 0:43 ` Andreas Dilger
0 siblings, 1 reply; 3+ messages in thread
From: Michael Forney @ 2020-04-05 4:53 UTC (permalink / raw)
To: linux-ext4
The pointer operand to the binary `+` operator must be to a complete
object type.
Signed-off-by: Michael Forney <mforney@mforney.org>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libext2fs: avoid pointer arithmetic on `void *`
2020-04-05 4:53 [PATCH] libext2fs: avoid pointer arithmetic on `void *` Michael Forney
@ 2020-04-06 0:43 ` Andreas Dilger
2020-04-14 1:59 ` Theodore Y. Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2020-04-06 0:43 UTC (permalink / raw)
To: Michael Forney; +Cc: linux-ext4
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
On Apr 4, 2020, at 10:53 PM, Michael Forney <mforney@mforney.org> wrote:
>
> The pointer operand to the binary `+` operator must be to a complete
> object type.
>
> Signed-off-by: Michael Forney <mforney@mforney.org>
Seems straight forward enough. Not needed for GCC, but strictly correct.
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> ---
> 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
>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libext2fs: avoid pointer arithmetic on `void *`
2020-04-06 0:43 ` Andreas Dilger
@ 2020-04-14 1:59 ` Theodore Y. Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-04-14 1:59 UTC (permalink / raw)
To: Andreas Dilger; +Cc: Michael Forney, linux-ext4
On Sun, Apr 05, 2020 at 06:43:09PM -0600, Andreas Dilger wrote:
> On Apr 4, 2020, at 10:53 PM, Michael Forney <mforney@mforney.org> wrote:
> >
> > The pointer operand to the binary `+` operator must be to a complete
> > object type.
> >
> > Signed-off-by: Michael Forney <mforney@mforney.org>
>
> Seems straight forward enough. Not needed for GCC, but strictly correct.
>
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Applied, thanks.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-14 1:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-05 4:53 [PATCH] libext2fs: avoid pointer arithmetic on `void *` Michael Forney
2020-04-06 0:43 ` Andreas Dilger
2020-04-14 1:59 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).