Skip to content

Commit 2b63d32

Browse files
vilattometa-codesync[bot]
authored andcommitted
Fix shorten-64-to-32 narrowing when reading requestedAttributes
Summary: requestedAttributes is a thrift unsigned64, but EntryAttributeFlags::raw takes std::underlying_type_t<FileAttributes> (int), so passing it directly performs an implicit 64-to-32 narrowing that clang-tidy flags as clang-diagnostic-shorten-64-to-32. Make the narrowing explicit with a static_cast. This cleans up every call site in EdenServiceHandler.cpp, covering both the futures paths (getAttributesFromFiles, readdir, semifuture_getAttributesFromFilesV2Impl) and the new coroutine paths (co_getAttributesFromFilesV2Impl). No behavior change: FileAttributes only uses the low bits, so no data was ever lost. Reviewed By: zzl0 Differential Revision: D112026415 fbshipit-source-id: c128fb1e147f16bd153a9261a3fbd96ecaba4db1
1 parent f2dd20e commit 2b63d32

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

eden/fs/service/EdenServiceHandler.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4341,8 +4341,9 @@ EdenServiceHandler::semifuture_readdir(std::unique_ptr<ReaddirParams> params) {
43414341
getSyncTimeout(*params->sync()),
43424342
toLogArg(paths));
43434343
auto& fetchContext = helper->getFetchContext();
4344-
auto requestedAttributes =
4345-
EntryAttributeFlags::raw(*params->requestedAttributes());
4344+
auto requestedAttributes = EntryAttributeFlags::raw(
4345+
static_cast<std::underlying_type_t<FileAttributes>>(
4346+
*params->requestedAttributes()));
43464347

43474348
return wrapImmediateFuture(
43484349
std::move(helper),
@@ -4403,8 +4404,9 @@ EdenServiceHandler::co_readdirImpl(std::unique_ptr<ReaddirParams> params) {
44034404
getSyncTimeout(*params->sync()),
44044405
toLogArg(paths));
44054406
auto& fetchContext = helper->getFetchContext();
4406-
auto requestedAttributes =
4407-
EntryAttributeFlags::raw(*params->requestedAttributes());
4407+
auto requestedAttributes = EntryAttributeFlags::raw(
4408+
static_cast<std::underlying_type_t<FileAttributes>>(
4409+
*params->requestedAttributes()));
44084410

44094411
co_await co_waitForPendingWrites(mountHandle.getEdenMount(), *params->sync());
44104412

@@ -4751,7 +4753,9 @@ EdenServiceHandler::co_getAttributesFromFilesV2Impl(
47514753
auto mountHandle = lookupMount(params->mountPoint());
47524754
auto reqScope =
47534755
params->scope().value_or(AttributesRequestScope::TREES_AND_FILES);
4754-
auto reqBitmask = EntryAttributeFlags::raw(*params->requestedAttributes());
4756+
auto reqBitmask = EntryAttributeFlags::raw(
4757+
static_cast<std::underlying_type_t<FileAttributes>>(
4758+
*params->requestedAttributes()));
47554759
std::vector<std::string>& paths = params->paths().value();
47564760
auto helper = INSTRUMENT_THRIFT_CALL(
47574761
DBG3,
@@ -4788,7 +4792,9 @@ EdenServiceHandler::semifuture_getAttributesFromFilesV2Impl(
47884792
auto mountHandle = lookupMount(params->mountPoint());
47894793
auto reqScope =
47904794
params->scope().value_or(AttributesRequestScope::TREES_AND_FILES);
4791-
auto reqBitmask = EntryAttributeFlags::raw(*params->requestedAttributes());
4795+
auto reqBitmask = EntryAttributeFlags::raw(
4796+
static_cast<std::underlying_type_t<FileAttributes>>(
4797+
*params->requestedAttributes()));
47924798
std::vector<std::string>& paths = params->paths().value();
47934799
auto helper = INSTRUMENT_THRIFT_CALL(
47944800
DBG3,

0 commit comments

Comments
 (0)