mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@bergmann-dalldorf.de>
To: Matt Reppert <arashi@arashi.yi.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Unsafe MODULE_ usage in crc32.c
Date: Mon, 02 Dec 2002 14:31:10 +0100	[thread overview]
Message-ID: <200212021205.NAA22003@post.webmailer.de> (raw)
In-Reply-To: <20021130181224.4b4cddad.arashi@arashi.yi.org>

Matt Reppert wrote:

> Okay, I know, it's just a library module, doesn't need to ever be unloaded
> anyway. But error noise in dmesg annoys me, hence this patch.

I don't think you even need to set the use count at all for crc32:
As long as another module is using it, you can't unload it because
the exported symbols are used. When those symbols are not known
to other modules, it is also safe to unload crc32.

I noticed another small problem with init_crc: if crc32init_be()
fails, the memory allocated by crc32init_le() is never freed,
see below.

	Arnd <><

--- 1.5/lib/crc32.c	Mon Apr  8 22:22:00 2002
+++ edited/lib/crc32.c	Mon Dec  2 14:25:37 2002
@@ -547,11 +547,13 @@
  */
 static int __init init_crc32(void)
 {
-	int rc1, rc2, rc;
-	rc1 = crc32init_le();
-	rc2 = crc32init_be();
-	rc = rc1 || rc2;
-	if (!rc) MOD_INC_USE_COUNT;
+	int rc;
+	rc = crc32init_le();
+	if (rc)
+		return rc;
+	rc = crc32init_be();
+	if (rc)
+		crc32cleanup_le();
 	return rc;
 }

  parent reply	other threads:[~2002-12-02 11:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-01  0:12 Matt Reppert
2002-12-01  0:25 ` Petr Vandrovec
2002-12-02 13:31 ` Arnd Bergmann [this message]
2002-12-02 16:08   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200212021205.NAA22003@post.webmailer.de \
    --to=arnd@bergmann-dalldorf.de \
    --cc=arashi@arashi.yi.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome