Revert "ALSA: core: add isascii() check to card ID generator"

This reverts commit d07842a6da.
This commit is contained in:
Ksawlii 2024-11-24 00:23:04 +01:00
parent d4a40a2874
commit 03acea760d

View file

@ -534,19 +534,13 @@ int snd_card_free(struct snd_card *card)
}
EXPORT_SYMBOL(snd_card_free);
/* check, if the character is in the valid ASCII range */
static inline bool safe_ascii_char(char c)
{
return isascii(c) && isalnum(c);
}
/* retrieve the last word of shortname or longname */
static const char *retrieve_id_from_card_name(const char *name)
{
const char *spos = name;
while (*name) {
if (isspace(*name) && safe_ascii_char(name[1]))
if (isspace(*name) && isalnum(name[1]))
spos = name + 1;
name++;
}
@ -573,12 +567,12 @@ static void copy_valid_id_string(struct snd_card *card, const char *src,
{
char *id = card->id;
while (*nid && !safe_ascii_char(*nid))
while (*nid && !isalnum(*nid))
nid++;
if (isdigit(*nid))
*id++ = isalpha(*src) ? *src : 'D';
while (*nid && (size_t)(id - card->id) < sizeof(card->id) - 1) {
if (safe_ascii_char(*nid))
if (isalnum(*nid))
*id++ = *nid;
nid++;
}
@ -676,7 +670,7 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
for (idx = 0; idx < copy; idx++) {
c = buf[idx];
if (!safe_ascii_char(c) && c != '_' && c != '-')
if (!isalnum(c) && c != '_' && c != '-')
return -EINVAL;
}
memcpy(buf1, buf, copy);