[PATCH] Fix snd_seq_queue_find_name()

From: Ben Collins (bcollins@debian.org)
Date: Sun May 25 2003 - 13:28:13 EST


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);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/