[PATCH 2/2] crypto: mxs_dcp: Use sg_mapping_iter to copy data

Sean Anderson sean.anderson at seco.com
Mon Jun 28 10:44:01 PDT 2021



On 6/27/21 11:25 PM, Herbert Xu wrote:
> On Fri, Jun 25, 2021 at 10:49:08AM -0400, Sean Anderson wrote:
>>
>> What version of sparse are you using? With sparse 0.6.2, gcc 9.3.0, and
>> with C=1 and W=2 I don't see this warning.
>
> OK I've upgraded my sparse to the latest git tree, but it still
> gives the same warning, because the two types are of different
> sizes:
>
> $ make C=1 W=1 O=build-compile drivers/crypto/
> make[1]: Entering directory '/home/herbert/src/build/kernel/test/build-compile'
>    GEN     Makefile
>    CALL    ../scripts/checksyscalls.sh
>    CALL    ../scripts/atomic/check-atomics.sh
>    CC [M]  drivers/crypto/mxs-dcp.o
> In file included from ../include/linux/kernel.h:15,
>                   from ../arch/x86/include/asm/percpu.h:27,
>                   from ../arch/x86/include/asm/current.h:6,
>                   from ../include/linux/sched.h:12,
>                   from ../include/linux/ratelimit.h:6,
>                   from ../include/linux/dev_printk.h:16,
>                   from ../include/linux/device.h:15,
>                   from ../include/linux/dma-mapping.h:7,
>                   from ../drivers/crypto/mxs-dcp.c:8:
> ../drivers/crypto/mxs-dcp.c: In function \u2018mxs_dcp_aes_block_crypt\u2019:
> ../include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast
>    (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
>                              ^~
> ../include/linux/minmax.h:32:4: note: in expansion of macro \u2018__typecheck\u2019
>     (__typecheck(x, y) && __no_side_effects(x, y))
>      ^~~~~~~~~~~
> ../include/linux/minmax.h:42:24: note: in expansion of macro \u2018__safe_cmp\u2019
>    __builtin_choose_expr(__safe_cmp(x, y), \
>                          ^~~~~~~~~~
> ../include/linux/minmax.h:51:19: note: in expansion of macro \u2018__careful_cmp\u2019
>   #define min(x, y) __careful_cmp(x, y, <)
>                     ^~~~~~~~~~~~~
> ../drivers/crypto/mxs-dcp.c:369:12: note: in expansion of macro \u2018min\u2019
>        rem = min(dst_iter.length, actx->fill);
>              ^~~
>    CHECK   ../drivers/crypto/mxs-dcp.c
> ../drivers/crypto/mxs-dcp.c:369:47: error: incompatible types in comparison expression (different type sizes):
> ../drivers/crypto/mxs-dcp.c:369:47:    unsigned long *
> ../drivers/crypto/mxs-dcp.c:369:47:    unsigned int *
> make[1]: Leaving directory '/home/herbert/src/build/kernel/test/build-compile'
> $
>
> In fact as you can see that gcc is warning too.  Perhaps you're
> building on 32-bit?

Ah, that would be it. Although this module depends on ARCH_MXS ||
ARCH_MXC and does not (yet) have COMPILE_TEST as an option, so I wonder
how you ran into this :)

Either way, I will send a v2 with this fixed.

>
> Thanks,
>



More information about the linux-arm-kernel mailing list