public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix snd_seq_queue_find_name()
@ 2003-05-25 17:34 Ben Collins
  0 siblings, 0 replies; only message in thread
From: Ben Collins @ 2003-05-25 17:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

While going through sound/ for strncpy replacing, I came across this
routine:

/* return the (first) queue matching with the specified name */
queue_t *snd_seq_queue_find_name(char *name)
{
        int i;
        queue_t *q;

        for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
                if ((q = queueptr(i)) != NULL) {
                        if (strncpy(q->name, name, sizeof(q->name)) == 0)
                                return q;
                        queuefree(q);
                }
        }
        return NULL;
}


I'm _really_ sure that they meant to use strncmp() here instead. Patch
below fixes it.


Index: sound/core/seq/seq_queue.c
===================================================================
--- sound/core/seq/seq_queue.c	(revision 10041)
+++ sound/core/seq/seq_queue.c	(working copy)
@@ -241,7 +241,7 @@
 
 	for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
 		if ((q = queueptr(i)) != NULL) {
-			if (strncpy(q->name, name, sizeof(q->name)) == 0)
+			if (strncmp(q->name, name, sizeof(q->name)) == 0)
 				return q;
 			queuefree(q);
 		}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-25 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-25 17:34 [PATCH] Fix snd_seq_queue_find_name() Ben Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox