All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: skcipher: remove static declaration of export function
@ 2018-06-17 17:49 efremov
  2018-06-18 17:28 ` Eric Biggers
  2018-06-19 20:23 ` [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next efremov
  0 siblings, 2 replies; 5+ messages in thread
From: efremov @ 2018-06-17 17:49 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, linux-crypto, linux-kernel, ldv-project, Denis Efremov

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).

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 crypto/skcipher.c                  | 4 +---
 include/crypto/internal/skcipher.h | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 0fe2a2923ad0..d28d2f2be562 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -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;
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index e42f7063f245..8602684d912b 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -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)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: skcipher: remove static declaration of export function
  2018-06-17 17:49 [PATCH] crypto: skcipher: remove static declaration of export function efremov
@ 2018-06-18 17:28 ` Eric Biggers
  2018-06-19 14:27   ` Herbert Xu
  2018-06-19 20:23 ` [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next efremov
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Biggers @ 2018-06-18 17:28 UTC (permalink / raw)
  To: efremov
  Cc: Herbert Xu, David S. Miller, linux-crypto, linux-kernel, ldv-project

On Sun, Jun 17, 2018 at 08:49:59PM +0300, efremov@linux.com 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).
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>

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

- Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: skcipher: remove static declaration of export function
  2018-06-18 17:28 ` Eric Biggers
@ 2018-06-19 14:27   ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2018-06-19 14:27 UTC (permalink / raw)
  To: Eric Biggers
  Cc: efremov, David S. Miller, linux-crypto, linux-kernel, ldv-project

On Mon, Jun 18, 2018 at 10:28:03AM -0700, Eric Biggers wrote:
> On Sun, Jun 17, 2018 at 08:49:59PM +0300, efremov@linux.com 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).
> > 
> > Signed-off-by: Denis Efremov <efremov@linux.com>
> 
> Why not remove the EXPORT_SYMBOL instead?  It has no users outside the file.

I agree.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next
  2018-06-17 17:49 [PATCH] crypto: skcipher: remove static declaration of export function efremov
  2018-06-18 17:28 ` Eric Biggers
@ 2018-06-19 20:23 ` efremov
  2018-07-01 13:19   ` Herbert Xu
  1 sibling, 1 reply; 5+ messages in thread
From: efremov @ 2018-06-19 20:23 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Eric Biggers, David S. Miller, linux-crypto, linux-kernel,
	ldv-project, Denis Efremov

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).

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 crypto/skcipher.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 0fe2a2923ad0..7d6a49fe3047 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -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)
 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next
  2018-06-19 20:23 ` [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next efremov
@ 2018-07-01 13:19   ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2018-07-01 13:19 UTC (permalink / raw)
  To: efremov
  Cc: Eric Biggers, David S. Miller, linux-crypto, linux-kernel, ldv-project

On Tue, Jun 19, 2018 at 11:23:57PM +0300, efremov@linux.com 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).
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-01 13:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-17 17:49 [PATCH] crypto: skcipher: remove static declaration of export function efremov
2018-06-18 17:28 ` Eric Biggers
2018-06-19 14:27   ` Herbert Xu
2018-06-19 20:23 ` [PATCH v2] crypto: skcipher: remove the exporting of skcipher_walk_next efremov
2018-07-01 13:19   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.