lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874isob63o.wl-tiwai@suse.de>
Date: Sat, 27 Sep 2025 11:24:43 +0200
From: Takashi Iwai <tiwai@...e.de>
To: cryolitia@...ontech.com
Cc: Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	Jonathan Corbet <corbet@....net>,
	Mingcong Bai <jeffbai@...c.io>,
	Kexy Biscuit <kexybiscuit@...c.io>,
	Nie Cheng <niecheng1@...ontech.com>,
	Zhan Jun <zhanjun@...ontech.com>,
	Feng Yuan <fengyuan@...ontech.com>,
	qaqland <anguoli@...ontech.com>,
	kernel@...ontech.com,
	linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org,
	Takashi Iwai <tiwai@...e.de>
Subject: Re: [PATCH v5 1/4] ALSA: usb-audio: add two-way convert between name and bit for QUIRK_FLAG_*

On Thu, 25 Sep 2025 11:25:16 +0200,
Cryolitia PukNgae via B4 Relay wrote:
> +u32 snd_usb_quirk_flags_from_name(const char *name)
> +{
> +	char *upper;
> +	int i;
> +
> +	upper = kstrdup(name, GFP_KERNEL);
> +
> +	if (!upper)
> +		return 0;
> +
> +	string_upper(upper, upper);
> +
> +	if (!name || !*name)
> +		return 0;
> +
> +	for (i = 0; snd_usb_audio_quirk_flag_names[i]; i++) {
> +		if (strcmp(name, snd_usb_audio_quirk_flag_names[i]) == 0 ||
> +		    strcmp(upper, snd_usb_audio_quirk_flag_names[i]) == 0) {
> +			kfree(upper);
> +			return BIT_U32(i);
> +		}
> +	}
> +
> +	kfree(upper);
> +	return 0;
> +}

I suppose you can write simpler code with strcasecmp().


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ