Patch "crypto: caam/qi - fix compilation with DEBUG enabled" has been added to the 4.13-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
crypto: caam/qi - fix compilation with DEBUG enabled
to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
crypto-caam-qi-fix-compilation-with-debug-enabled.patch
and it can be found in the queue-4.13 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
972b812bd1e17cb0a9112f565951795f886fcc94Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Horia=20Geant=C4=83?= <[email protected]>
Date: Mon, 10 Jul 2017 08:40:28 +0300
Subject: crypto: caam/qi - fix compilation with DEBUG enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Horia Geantă <[email protected]>
commit 972b812bd1e17cb0a9112f565951795f886fcc94 upstream.
caam/qi driver does not compile when DEBUG is enabled (CRYPTO_DEV_FSL_CAAM_DEBUG=y):
drivers/crypto/caam/caamalg_qi.c: In function 'ablkcipher_done':drivers/crypto/caam/caamalg_qi.c:794:2: error: implicit declaration of function 'dbg_dump_sg' [-Werror=implicit-function-declaration]
dbg_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ",
Since dbg_dump_sg() is shared between caam/jr and caam/qi, move it in a shared location and export it.
At the same time:
-reduce ifdeferry by providing a no-op implementation for !DEBUG case -rename it to caam_dump_sg() to be consistent in terms of exported symbols namespace (caam_*)
--- drivers/crypto/caam/caamalg.c | 66 ++++++++------------------------------- drivers/crypto/caam/caamalg_qi.c | 6 +-- drivers/crypto/caam/error.c | 40 +++++++++++++++++++++++ drivers/crypto/caam/error.h | 4 ++ 4 files changed, 62 insertions(+), 54 deletions(-)
drivers/crypto/caam/caamalg.c +15 -51
@@ -81,40 +81,6 @@ #define debug(format, arg...)#endif -#ifdef DEBUG -#include <linux/highmem.h> - -static void dbg_dump_sg (const char *level,const char *prefix_str, -int prefix_type,int rowsize,int groupsize, -struct scatterlist *sg,size_t tlen,bool ascii) -{ -struct scatterlist *it; -void *it_page; -size_t len; -void *buf; - -for (it = sg; it !=NULL && tlen >0 ; it =sg_next (sg)) { -/* -* make sure the scatterlist's page -* has a valid virtual memory mapping -*/ - it_page =kmap_atomic (sg_page (it)); -if (unlikely (!it_page)) { -printk (KERN_ERR "dbg_dump_sg: kmap failed\n" ); -return ; - } - - buf = it_page + it->offset; - len =min_t (size_t, tlen, it->length); -print_hex_dump (level, prefix_str, prefix_type, rowsize, - groupsize, buf, len, ascii); - tlen -= len; - -kunmap_atomic (it_page); - } -} -#endif -static struct list_head alg_list;struct caam_alg_entry {
@@ -898,10 +864,10 @@ static void ablkcipher_encrypt_done(stru print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",DUMP_PREFIX_ADDRESS ,16 ,4 , req->info, edesc->src_nents >1 ?100 : ivsize,1 ); - dbg_dump_sg(KERN_ERR, "dst @"__stringify(__LINE__)": ", -DUMP_PREFIX_ADDRESS ,16 ,4 , req->dst, - edesc->dst_nents >1 ?100 : req->nbytes,1 );#endif + caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", +DUMP_PREFIX_ADDRESS ,16 ,4 , req->dst, + edesc->dst_nents >1 ?100 : req->nbytes,1 );ablkcipher_unmap (jrdev, edesc, req);
@@ -937,10 +903,10 @@ static void ablkcipher_decrypt_done(stru print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ",DUMP_PREFIX_ADDRESS ,16 ,4 , req->info, ivsize,1 ); - dbg_dump_sg(KERN_ERR, "dst @"__stringify(__LINE__)": ", -DUMP_PREFIX_ADDRESS ,16 ,4 , req->dst, - edesc->dst_nents >1 ?100 : req->nbytes,1 );#endif + caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", +DUMP_PREFIX_ADDRESS ,16 ,4 , req->dst, + edesc->dst_nents >1 ?100 : req->nbytes,1 );ablkcipher_unmap (jrdev, edesc, req);
@@ -1107,10 +1073,10 @@ static void init_ablkcipher_job(u32 *sh_ ivsize, 1);pr_err ("asked=%d, nbytes%d\n" , (int )edesc->src_nents >1 ?100 : req->nbytes, req->nbytes); - dbg_dump_sg(KERN_ERR, "src @"__stringify(__LINE__)": ", -DUMP_PREFIX_ADDRESS ,16 ,4 , req->src, - edesc->src_nents >1 ?100 : req->nbytes,1 );#endif + caam_dump_sg(KERN_ERR, "src @" __stringify(__LINE__)": ", +DUMP_PREFIX_ADDRESS ,16 ,4 , req->src, + edesc->src_nents >1 ?100 : req->nbytes,1 ); len =desc_len (sh_desc);init_job_desc_shared (desc, ptr, len,HDR_SHARE_DEFER |HDR_REVERSE );
@@ -1164,10 +1130,10 @@ static void init_ablkcipher_giv_job(u32 print_hex_dump(KERN_ERR, "presciv@" __stringify(__LINE__) ": ",DUMP_PREFIX_ADDRESS ,16 ,4 , req->info, ivsize,1 ); - dbg_dump_sg(KERN_ERR, "src @" __stringify(__LINE__) ": ", -DUMP_PREFIX_ADDRESS ,16 ,4 , req->src, - edesc->src_nents >1 ?100 : req->nbytes,1 );#endif + caam_dump_sg(KERN_ERR, "src @" __stringify(__LINE__) ": ", +DUMP_PREFIX_ADDRESS ,16 ,4 , req->src, + edesc->src_nents >1 ?100 : req->nbytes,1 ); len =desc_len (sh_desc);init_job_desc_shared (desc, ptr, len,HDR_SHARE_DEFER |HDR_REVERSE );
@@ -1449,11 +1415,9 @@ static int aead_decrypt(struct aead_requu32 *desc;int ret =0 ; -#ifdef DEBUG - dbg_dump_sg(KERN_ERR, "dec src@"__stringify(__LINE__)": ", -DUMP_PREFIX_ADDRESS ,16 ,4 , req->src, - req->assoclen + req->cryptlen,1 ); -#endif + caam_dump_sg(KERN_ERR, "dec src@" __stringify(__LINE__)": ", +DUMP_PREFIX_ADDRESS ,16 ,4 , req->src, + req->assoclen + req->cryptlen,1 );/* allocate extended descriptor */ edesc = aead_edesc_alloc(req, AUTHENC_DESC_JOB_IO_LEN,
drivers/crypto/caam/caamalg_qi.c +3 -3
@@ -791,9 +791,9 @@ static void ablkcipher_done(struct caam_ print_hex_dump(KERN_ERR, "dstiv @" __stringify(__LINE__)": ",DUMP_PREFIX_ADDRESS ,16 ,4 , req->info, edesc->src_nents >1 ?100 : ivsize,1 ); - dbg_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", -DUMP_PREFIX_ADDRESS ,16 ,4 , req->dst, - edesc->dst_nents >1 ?100 : req->nbytes,1 ); + caam_dump_sg(KERN_ERR, "dst @" __stringify(__LINE__)": ", +DUMP_PREFIX_ADDRESS ,16 ,4 , req->dst, + edesc->dst_nents >1 ?100 : req->nbytes,1 );#endif ablkcipher_unmap (qidev, edesc, req);
drivers/crypto/caam/error.c +40 -0
@@ -9,6 +9,46 @@#include "desc.h" #include "error.h" +#ifdef DEBUG +#include <linux/highmem.h> + +void caam_dump_sg (const char *level,const char *prefix_str,int prefix_type, +int rowsize,int groupsize,struct scatterlist *sg, +size_t tlen,bool ascii) +{ +struct scatterlist *it; +void *it_page; +size_t len; +void *buf; + +for (it = sg; it && tlen >0 ; it =sg_next (sg)) { +/* +* make sure the scatterlist's page +* has a valid virtual memory mapping +*/ + it_page =kmap_atomic (sg_page (it)); +if (unlikely (!it_page)) { +pr_err ("caam_dump_sg: kmap failed\n" ); +return ; + } + + buf = it_page + it->offset; + len =min_t (size_t, tlen, it->length); +print_hex_dump (level, prefix_str, prefix_type, rowsize, + groupsize, buf, len, ascii); + tlen -= len; + +kunmap_atomic (it_page); + } +} +#else +void caam_dump_sg (const char *level,const char *prefix_str,int prefix_type, +int rowsize,int groupsize,struct scatterlist *sg, +size_t tlen,bool ascii) +{} +#endif /* DEBUG */ +EXPORT_SYMBOL (caam_dump_sg); + static const struct { u8 value; const char *error_text;
drivers/crypto/caam/error.h +4 -0
@@ -8,4 +8,8 @@#define CAAM_ERROR_H #define CAAM_ERROR_STR_MAX 302void caam_jr_strstatus (struct device *jrdev,u32 status); + +void caam_dump_sg (const char *level,const char *prefix_str,int prefix_type, +int rowsize,int groupsize,struct scatterlist *sg, +size_t tlen,bool ascii);#endif /* CAAM_ERROR_H */
Patches currently in stable-queue which might be from [email protected] are
queue-4.13/staging-fsl-dpaa2-eth-fix-off-by-one-fd-ctrl-bitmaks.patch queue-4.13/crypto-caam-qi-fix-compilation-with-config_debug_force_weak_per_cpu-y.patch queue-4.13/crypto-caam-qi-fix-compilation-with-debug-enabled.patch