[ammarfaizi2-block:dhowells/linux-fs/netfs-maple 29/44] fs/netfs/crypto.c:76:10: warning: comparison of distinct pointer types ('typeof (len) (aka 'unsigned int and 'typeof (((1UL) << 12) - offset) (aka 'unsigned long

From: kernel test robot
Date: Mon Apr 25 2022 - 09:42:30 EST


tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-maple
head: 931e50676c6598d0eda1954ead465519ff91874d
commit: 030bb8e418ec7ca1b1411ccc9b4528311880388f [29/44] netfs: Decrypt encrypted content
config: mips-randconfig-r022-20220425 (https://download.01.org/0day-ci/archive/20220425/202204252127.hel9AE2b-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/ammarfaizi2/linux-block/commit/030bb8e418ec7ca1b1411ccc9b4528311880388f
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-maple
git checkout 030bb8e418ec7ca1b1411ccc9b4528311880388f
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/netfs/crypto.c:76:10: warning: comparison of distinct pointer types ('typeof (len) (aka 'unsigned int and 'typeof (((1UL) << 12) - offset) (aka 'unsigned long
seg = min(len, PAGE_SIZE - offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), ^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
== (typeof(y)
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
fatal error: error in backend: Nested variants found in inline asm string: ' .set push
.set mips64r2
.if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/bitops.h", .line = 103, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
1: ll $0, $1
or $0, $2
sc $0, $1
beqz $0, 1b
.set pop
'
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -Wp,-MMD,fs/netfs/.crypto.o.d -nostdinc -Iarch/mips/include -I./arch/mips/include/generated -Iinclude -I./include -Iarch/mips/include/uapi -I./arch/mips/include/generated/uapi -Iinclude/uapi -I./include/generated/uapi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0xffffffff84000000 -DLINKER_LOAD_ADDRESS=0x84000000 -DDATAOFFSET=0 -Qunused-arguments -fmacro-prefix-map== -DKBUILD_EXTRA_WARN1 -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 --target=mipsel-linux -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float -ffreestanding -EL -fno-stack-check -march=mips32r2 -Wa,--trap -DTOOLCHAIN_SUPPORTS_VIRT -Iarch/mips/include/asm/mach-ingenic -Iarch/mips/include/asm/mach-generic -Iarch/mips/include/asm/mach-generic -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -Os -Wframe-larger-than=1024 -fstack-protector -Wimplicit-fallthrough -Wno-gnu -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-stack-clash-protection -pg -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wextra -Wunused -Wno-unused-parameter -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wmissing-include-dirs -Wunused-but-set-variable -Wunused-const-variable -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-shift-negative-value -I fs/netfs -I ./fs/netfs -ffunction-sections -fdata-sections -DKBUILD_MODFILE="fs/netfs/netfs" -DKBUILD_BASENAME="crypto" -DKBUILD_MODNAME="netfs" -D__KBUILD_MODNAME=kmod_netfs -c -o fs/netfs/crypto.o fs/netfs/crypto.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'fs/netfs/crypto.c'.
4. Running pass 'Mips Assembly Printer' on function '@netfs_decrypt'
#0 0x000055991084aa2f Signals.cpp:0:0
#1 0x0000559910848854 llvm::sys::CleanupOnSignal(unsigned long) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x34bf854)
#2 0x0000559910787cf7 llvm::CrashRecoveryContext::HandleExit(int) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x33fecf7)
#3 0x0000559910840e8e llvm::sys::Process::Exit(int, bool) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x34b7e8e)
#4 0x000055990e44a5db (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x10c15db)
#5 0x000055991078e81c llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x340581c)
#6 0x00005599114c4a30 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x413ba30)
#7 0x00005599114c0932 llvm::AsmPrinter::emitFunctionBody() (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x4137932)
#8 0x000055990eed8f77 llvm::MipsAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x1b4ff77)
#9 0x000055990fbbaf8d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.53) MachineFunctionPass.cpp:0:0
#10 0x0000559910001597 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x2c78597)
#11 0x0000559910001711 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x2c78711)
#12 0x000055991000228f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x2c7928f)
#13 0x0000559910b7534f clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x37ec34f)
#14 0x00005599117e9e11 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x4460e11)
#15 0x00005599123586b1 clang::ParseAST(clang::Sema&, bool, bool) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x4fcf6b1)
#16 0x00005599117e94d5 clang::CodeGenAction::ExecuteAction() (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x44604d5)
#17 0x00005599111d8be1 clang::FrontendAction::Execute() (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x3e4fbe1)
#18 0x000055991116d5aa clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x3de45aa)
#19 0x00005599112a02db (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x3f172db)
#20 0x000055990e44bb8c cc1_main(llvm::ArrayRef<char char (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x10c2b8c)
#21 0x000055990e44885b ExecuteCC1Tool(llvm::SmallVectorImpl<char driver.cpp:0:0
#22 0x0000559910ffe5e5 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const::'lambda'()>(long) Job.cpp:0:0
#23 0x0000559910787bb3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x33febb3)
#24 0x0000559910ffeede clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const (.part.216) Job.cpp:0:0
#25 0x0000559910fd2757 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x3c49757)
#26 0x0000559910fd3137 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) const (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x3c4a137)
#27 0x0000559910fdcc59 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x3c53c59)
#28 0x000055990e394a0f main (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x100ba0f)
#29 0x00007f60dc3a97fd __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x237fd)
#30 0x000055990e44837a _start (/opt/cross/clang-1cddcfdc3c/bin/clang-15+0x10bf37a)
clang-15: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 15.0.0 (git://gitmirror/llvm_project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
Target: mipsel-unknown-linux
Thread model: posix
InstalledDir: /opt/cross/clang-1cddcfdc3c/bin
clang-15: note: diagnostic msg:
Makefile arch fs include kernel nr_bisected scripts source usr


vim +76 fs/netfs/crypto.c

777536e6af57bec David Howells 2021-07-01 45
777536e6af57bec David Howells 2021-07-01 46 /*
777536e6af57bec David Howells 2021-07-01 47 * Populate a scatterlist from folios in an xarray.
777536e6af57bec David Howells 2021-07-01 48 */
777536e6af57bec David Howells 2021-07-01 49 static int netfs_xarray_to_sglist(struct xarray *xa, loff_t pos, size_t len,
777536e6af57bec David Howells 2021-07-01 50 struct scatterlist *sg, unsigned int n_sg)
777536e6af57bec David Howells 2021-07-01 51 {
777536e6af57bec David Howells 2021-07-01 52 struct scatterlist *p = sg;
777536e6af57bec David Howells 2021-07-01 53 struct folio *folio = NULL;
777536e6af57bec David Howells 2021-07-01 54 size_t seg, offset, skip = 0;
777536e6af57bec David Howells 2021-07-01 55 loff_t start = pos;
777536e6af57bec David Howells 2021-07-01 56 pgoff_t index = start >> PAGE_SHIFT;
777536e6af57bec David Howells 2021-07-01 57 int j;
777536e6af57bec David Howells 2021-07-01 58
777536e6af57bec David Howells 2021-07-01 59 XA_STATE(xas, xa, index);
777536e6af57bec David Howells 2021-07-01 60
777536e6af57bec David Howells 2021-07-01 61 sg_init_table(sg, n_sg);
777536e6af57bec David Howells 2021-07-01 62
777536e6af57bec David Howells 2021-07-01 63 rcu_read_lock();
777536e6af57bec David Howells 2021-07-01 64
777536e6af57bec David Howells 2021-07-01 65 xas_for_each(&xas, folio, ULONG_MAX) {
777536e6af57bec David Howells 2021-07-01 66 if (xas_retry(&xas, folio))
777536e6af57bec David Howells 2021-07-01 67 continue;
777536e6af57bec David Howells 2021-07-01 68 if (WARN_ON(xa_is_value(folio)) || WARN_ON(folio_test_hugetlb(folio)))
777536e6af57bec David Howells 2021-07-01 69 break;
777536e6af57bec David Howells 2021-07-01 70 for (j = (folio_index(folio) < index) ? index - folio_index(folio) : 0;
777536e6af57bec David Howells 2021-07-01 71 j < folio_nr_pages(folio); j++
777536e6af57bec David Howells 2021-07-01 72 ) {
777536e6af57bec David Howells 2021-07-01 73 struct page *subpage = folio_file_page(folio, j);
777536e6af57bec David Howells 2021-07-01 74
777536e6af57bec David Howells 2021-07-01 75 offset = (pos + skip) & ~PAGE_MASK;
777536e6af57bec David Howells 2021-07-01 @76 seg = min(len, PAGE_SIZE - offset);
777536e6af57bec David Howells 2021-07-01 77
777536e6af57bec David Howells 2021-07-01 78 sg_set_page(p++, subpage, seg, offset);
777536e6af57bec David Howells 2021-07-01 79
777536e6af57bec David Howells 2021-07-01 80 len -= seg;
777536e6af57bec David Howells 2021-07-01 81 skip += seg;
777536e6af57bec David Howells 2021-07-01 82 if (len == 0)
777536e6af57bec David Howells 2021-07-01 83 break;
777536e6af57bec David Howells 2021-07-01 84 }
777536e6af57bec David Howells 2021-07-01 85 if (len == 0)
777536e6af57bec David Howells 2021-07-01 86 break;
777536e6af57bec David Howells 2021-07-01 87 }
777536e6af57bec David Howells 2021-07-01 88
777536e6af57bec David Howells 2021-07-01 89 rcu_read_unlock();
777536e6af57bec David Howells 2021-07-01 90 if (len > 0) {
777536e6af57bec David Howells 2021-07-01 91 kdebug("*** Insufficient source (%zx)", len);
777536e6af57bec David Howells 2021-07-01 92 //WARN_ON(len > 0);
777536e6af57bec David Howells 2021-07-01 93 return -EIO;
777536e6af57bec David Howells 2021-07-01 94 }
777536e6af57bec David Howells 2021-07-01 95
777536e6af57bec David Howells 2021-07-01 96 sg_mark_end(p - 1);
777536e6af57bec David Howells 2021-07-01 97 return p - sg;
777536e6af57bec David Howells 2021-07-01 98 }
777536e6af57bec David Howells 2021-07-01 99

:::::: The code at line 76 was first introduced by commit
:::::: 777536e6af57becf14b8f4f34007ed3e3a95c911 netfs: Perform content encryption

:::::: TO: David Howells <dhowells@xxxxxxxxxx>
:::::: CC: David Howells <dhowells@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp