Skip to contentSkip to conversation

crypto: skcipher: remove static declaration of export function

PATCH In review [email protected] 3 participants 5 messages Jun 17, 2018 – Jul 1, 2018 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: skcipher: remove static declaration of export function

The function skcipher_walk_next declared as static and marked as EXPORT_SYMBOL. It's a bit confusing since export symbol means that we want others to use this function. The area of visibility for such function is its .c file and all other modules. Other *.c files of the same module can't use it, despite all other modules can. Relying on that such behavior was not the original intention, the patch just removes the static keyword.

Found by Linux Driver Verification project (linuxtesting.org).

---
 crypto/skcipher.c                  | 4 +---
 include/crypto/internal/skcipher.h | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)
crypto/skcipher.c +1 -3
index 0fe2a2923ad0..d28d2f2be562 100644
@@ -44,8 +44,6 @@ struct skcipher_walk_buffer {
 	u8 buffer[];
 };
 
-static int skcipher_walk_next(struct skcipher_walk *walk);
-
 static inline void skcipher_unmap(struct scatter_walk *walk, void *vaddr)
 {
 	if (PageHighMem(scatterwalk_page(walk)))
@@ -335,7 +333,7 @@ static int skcipher_next_fast(struct skcipher_walk *walk)
 	return 0;
 }
 
-static int skcipher_walk_next(struct skcipher_walk *walk)
+int skcipher_walk_next(struct skcipher_walk *walk)
 {
 	unsigned int bsize;
 	unsigned int n;
include/crypto/internal/skcipher.h +1 -0
index e42f7063f245..8602684d912b 100644
@@ -154,6 +154,7 @@ int skcipher_walk_aead_encrypt(struct skcipher_walk *walk,
 int skcipher_walk_aead_decrypt(struct skcipher_walk *walk,
 			       struct aead_request *req, bool atomic);
 void skcipher_walk_complete(struct skcipher_walk *walk, int err);
+int skcipher_walk_next(struct skcipher_walk *walk);
 
 static inline void ablkcipher_request_complete(struct ablkcipher_request *req,
 					       int err)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 11 lines · On Sun, Jun 17, 2018 at 08:49:59PM +0300, [email protected] wrote:

The function skcipher_walk_next declared as static and marked as EXPORT_SYMBOL. It's a bit confusing since export symbol means that we want others to use this function. The area of visibility for such function is its .c file and all other modules. Other *.c files of the same module can't use it, despite all other modules can. Relying on that such behavior was not the original intention, the patch just removes the static keyword.

Found by Linux Driver Verification project (linuxtesting.org).

Why not remove the EXPORT_SYMBOL instead? It has no users outside the file.

- Eric

maintainer
#2 lore raw
Quoted 9 lines · Eric Biggers
Quoted 8 lines · On Sun, Jun 17, 2018 at 08:49:59PM +0300, [email protected] wrote:

The function skcipher_walk_next declared as static and marked as EXPORT_SYMBOL. It's a bit confusing since export symbol means that we want others to use this function. The area of visibility for such function is its .c file and all other modules. Other *.c files of the same module can't use it, despite all other modules can. Relying on that such behavior was not the original intention, the patch just removes the static keyword.

Quoted 5 lines
Quoted 3 lines

Found by Linux Driver Verification project (linuxtesting.org).

Why not remove the EXPORT_SYMBOL instead? It has no users outside the file.

I agree.

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#3 lore raw

PATCH v2 1/1 crypto: skcipher: remove the exporting of skcipher_walk_next

In reply to [email protected]

The function skcipher_walk_next declared as static and marked as EXPORT_SYMBOL_GPL. It's a bit confusing for internal function to be exported. The area of visibility for such function is its .c file and all other modules. Other *.c files of the same module can't use it, despite all other modules can. Relying on the fact that this is the internal function and it's not a crucial part of the API, the patch just removes the EXPORT_SYMBOL_GPL marking of skcipher_walk_next.

Found by Linux Driver Verification project (linuxtesting.org).

---
 crypto/skcipher.c | 1 -
 1 file changed, 1 deletion(-)
crypto/skcipher.c +0 -1
index 0fe2a2923ad0..7d6a49fe3047 100644
@@ -387,7 +387,6 @@ static int skcipher_walk_next(struct skcipher_walk *walk)
 	}
 	return err;
 }
-EXPORT_SYMBOL_GPL(skcipher_walk_next);
 
 static int skcipher_copy_iv(struct skcipher_walk *walk)
 {
Signature · 1 line
2.17.1
maintainer
#4 lore raw

Re: [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next

Quoted 11 lines · On Tue, Jun 19, 2018 at 11:23:57PM +0300, [email protected] wrote:

The function skcipher_walk_next declared as static and marked as EXPORT_SYMBOL_GPL. It's a bit confusing for internal function to be exported. The area of visibility for such function is its .c file and all other modules. Other *.c files of the same module can't use it, despite all other modules can. Relying on the fact that this is the internal function and it's not a crucial part of the API, the patch just removes the EXPORT_SYMBOL_GPL marking of skcipher_walk_next.

Found by Linux Driver Verification project (linuxtesting.org).

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt