[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230121203230.27624-20-ebiggers@kernel.org>
Date: Sat, 21 Jan 2023 12:32:11 -0800
From: Eric Biggers <ebiggers@...nel.org>
To: linux-ext4@...r.kernel.org
Subject: [PATCH 19/38] lib/ext2fs: fix two compiler warnings in windows_io.c
From: Eric Biggers <ebiggers@...gle.com>
init_private_data() triggers a -Wstringop-truncation warning, due to a
real bug. Fix it.
windows_open() has a -Wunused-variable warning because some
macOS-specific code was copied there for no reason. Remove it.
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
lib/ext2fs/windows_io.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/lib/ext2fs/windows_io.c b/lib/ext2fs/windows_io.c
index 68b5571bb..83aea68b6 100644
--- a/lib/ext2fs/windows_io.c
+++ b/lib/ext2fs/windows_io.c
@@ -499,9 +499,6 @@ static errcode_t windows_open_channel(struct windows_private_data *data,
#if defined(O_DIRECT)
if (flags & IO_FLAG_DIRECT_IO)
io->align = ext2fs_get_dio_alignment(data->dev);
-#elif defined(F_NOCACHE)
- if (flags & IO_FLAG_DIRECT_IO)
- io->align = 4096;
#endif
/*
@@ -609,7 +606,7 @@ static struct windows_private_data *init_private_data(const char *name, int flag
return NULL;
memset(data, 0, sizeof(struct windows_private_data));
- strncpy(data->name, name, sizeof(data->name));
+ strncpy(data->name, name, sizeof(data->name) - 1);
data->magic = EXT2_ET_MAGIC_WINDOWS_IO_CHANNEL;
data->io_stats.num_fields = 2;
data->flags = flags;
@@ -620,7 +617,6 @@ static struct windows_private_data *init_private_data(const char *name, int flag
static errcode_t windows_open(const char *name, int flags, io_channel *channel)
{
- int fd = -1;
int open_flags;
struct windows_private_data *data;
@@ -644,12 +640,6 @@ static errcode_t windows_open(const char *name, int flags, io_channel *channel)
return EXT2_ET_BAD_DEVICE_NAME;
}
-#if defined(F_NOCACHE) && !defined(IO_DIRECT)
- if (flags & IO_FLAG_DIRECT_IO) {
- if (fcntl(fd, F_NOCACHE, 1) < 0)
- return errno;
- }
-#endif
return windows_open_channel(data, flags, channel, windows_io_manager);
}
--
2.39.0
Powered by blists - more mailing lists