• Damian Muszynski's avatar
    crypto: qat - use reference to structure in dma_map_single() · 072d36ee
    Damian Muszynski authored
    When mapping the input and output parameters, the implementations of RSA
    and DH pass to the function dma_map_single() a pointer to the first
    member of the structure they want to map instead of a pointer to the
    actual structure.
    This results in set of warnings reported by the static analyser Smatch:
    
        drivers/crypto/qat/qat_common/qat_asym_algs.c:335 qat_dh_compute_value() error: dma_map_single_attrs() '&qat_req->in.dh.in.b' too small (8 vs 64)
        drivers/crypto/qat/qat_common/qat_asym_algs.c:341 qat_dh_compute_value() error: dma_map_single_attrs() '&qat_req->out.dh.r' too small (8 vs 64)
        drivers/crypto/qat/qat_common/qat_asym_algs.c:732 qat_rsa_enc() error: dma_map_single_attrs() '&qat_req->in.rsa.enc.m' too small (8 vs 64)
        drivers/crypto/qat/qat_common/qat_asym_algs.c:738 qat_rsa_enc() error: dma_map_single_attrs() '&qat_req->out.rsa.enc.c' too small (8 vs 64)
        drivers/crypto/qat/qat_common/qat_asym_algs.c:878 qat_rsa_dec() error: dma_map_single_attrs() '&qat_req->in.rsa.dec.c' too small (8 vs 64)
        drivers/crypto/qat/qat_common/qat_asym_algs.c:884 qat_rsa_dec() error: dma_map_single_attrs() '&qat_req->out.rsa.dec.m' too small (8 vs 64)
    
    Where the address of the first element of a structure is used as an
    input for the function dma_map_single(), replace it with the address of
    the structure. This fix does not introduce any functional change as the
    addresses are the same.
    Signed-off-by: default avatarDamian Muszynski <damian.muszynski@intel.com>
    Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: default avatarAdam Guerin <adam.guerin@intel.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    072d36ee
qat_asym_algs.c 31.8 KB