Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f94a3597 authored by David Howells's avatar David Howells Committed by Herbert Xu
Browse files

crypto: pcomp - Constify (de)compression parameters



In testmgr, struct pcomp_testvec takes a non-const 'params' field, which is
pointed to a const deflate_comp_params or deflate_decomp_params object.  With
gcc-5 this incurs the following warnings:

In file included from ../crypto/testmgr.c:44:0:
../crypto/testmgr.h:28736:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
   .params = &deflate_comp_params,
             ^
../crypto/testmgr.h:28748:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
   .params = &deflate_comp_params,
             ^
../crypto/testmgr.h:28776:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
   .params = &deflate_decomp_params,
             ^
../crypto/testmgr.h:28800:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
   .params = &deflate_decomp_params,
             ^

Fix this by making the parameters pointer const and constifying the things
that use it.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent dcd93e83
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -28591,7 +28591,7 @@ struct comp_testvec {
};
};
struct pcomp_testvec {
struct pcomp_testvec {
	void *params;
	const void *params;
	unsigned int paramsize;
	unsigned int paramsize;
	int inlen, outlen;
	int inlen, outlen;
	char input[COMP_BUF_SIZE];
	char input[COMP_BUF_SIZE];
+2 −2
Original line number Original line Diff line number Diff line
@@ -78,7 +78,7 @@ static void zlib_exit(struct crypto_tfm *tfm)
}
}




static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params,
static int zlib_compress_setup(struct crypto_pcomp *tfm, const void *params,
			       unsigned int len)
			       unsigned int len)
{
{
	struct zlib_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
	struct zlib_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
@@ -209,7 +209,7 @@ static int zlib_compress_final(struct crypto_pcomp *tfm,
}
}




static int zlib_decompress_setup(struct crypto_pcomp *tfm, void *params,
static int zlib_decompress_setup(struct crypto_pcomp *tfm, const void *params,
				 unsigned int len)
				 unsigned int len)
{
{
	struct zlib_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
	struct zlib_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
+4 −4
Original line number Original line Diff line number Diff line
@@ -55,14 +55,14 @@ struct crypto_pcomp {
};
};


struct pcomp_alg {
struct pcomp_alg {
	int (*compress_setup)(struct crypto_pcomp *tfm, void *params,
	int (*compress_setup)(struct crypto_pcomp *tfm, const void *params,
			      unsigned int len);
			      unsigned int len);
	int (*compress_init)(struct crypto_pcomp *tfm);
	int (*compress_init)(struct crypto_pcomp *tfm);
	int (*compress_update)(struct crypto_pcomp *tfm,
	int (*compress_update)(struct crypto_pcomp *tfm,
			       struct comp_request *req);
			       struct comp_request *req);
	int (*compress_final)(struct crypto_pcomp *tfm,
	int (*compress_final)(struct crypto_pcomp *tfm,
			      struct comp_request *req);
			      struct comp_request *req);
	int (*decompress_setup)(struct crypto_pcomp *tfm, void *params,
	int (*decompress_setup)(struct crypto_pcomp *tfm, const void *params,
				unsigned int len);
				unsigned int len);
	int (*decompress_init)(struct crypto_pcomp *tfm);
	int (*decompress_init)(struct crypto_pcomp *tfm);
	int (*decompress_update)(struct crypto_pcomp *tfm,
	int (*decompress_update)(struct crypto_pcomp *tfm,
@@ -97,7 +97,7 @@ static inline struct pcomp_alg *crypto_pcomp_alg(struct crypto_pcomp *tfm)
}
}


static inline int crypto_compress_setup(struct crypto_pcomp *tfm,
static inline int crypto_compress_setup(struct crypto_pcomp *tfm,
					void *params, unsigned int len)
					const void *params, unsigned int len)
{
{
	return crypto_pcomp_alg(tfm)->compress_setup(tfm, params, len);
	return crypto_pcomp_alg(tfm)->compress_setup(tfm, params, len);
}
}
@@ -120,7 +120,7 @@ static inline int crypto_compress_final(struct crypto_pcomp *tfm,
}
}


static inline int crypto_decompress_setup(struct crypto_pcomp *tfm,
static inline int crypto_decompress_setup(struct crypto_pcomp *tfm,
					  void *params, unsigned int len)
					  const void *params, unsigned int len)
{
{
	return crypto_pcomp_alg(tfm)->decompress_setup(tfm, params, len);
	return crypto_pcomp_alg(tfm)->decompress_setup(tfm, params, len);
}
}