0

I try to compile an android kernel with gcc 5.2 and i fixed all errors, except this:

crypto/testmgr.c:1112:36: warning: passing argument 2 of 'crypto_compress_setup' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
error, forbidden warning: testmgr.c:1112

Here is the code:

static int test_pcomp(struct crypto_pcomp *tfm,
                      struct pcomp_testvec *ctemplate,
                      struct pcomp_testvec *dtemplate, int ctcount,
                      int dtcount)
{
    const char *algo = crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm));
    unsigned int i;
    char result[COMP_BUF_SIZE];
    int res;

    for (i = 0; i < ctcount; i++) {
        struct comp_request req;
        unsigned int produced = 0;

        res = crypto_compress_setup(tfm, ctemplate[i].params,
                        ctemplate[i].paramsize);
        if (res) {
            pr_err("alg: pcomp: compression setup failed on test "
                   "%d for %s: error=%d\n", i + 1, algo, res);
            return res;
Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75
  • 1
    Look at [struct pcomp_testvec](http://lxr.free-electrons.com/source/crypto/testmgr.h#L30574) definition. As you can see, `.params` field has type of `const void *` there. So this `const` qualifier should be respected further. But it seems like `crypto_compress_setup()` takes it's second param not as a constant in your case. This is why compiler throwing that warning. But this is strange, as mainline kernel has this parameter declared correctly: look [here](http://lxr.free-electrons.com/source/include/crypto/compress.h#L99) (line 99). So I'd check `crypto_compress_setup()` in your kernel. – Sam Protsenko Oct 26 '15 at 22:30
  • Yes, the const in compress.h was missing.Thank you very much. – David Müller Oct 28 '15 at 17:16

0 Answers0