Skip to contentSkip to conversation

ALSA: seq: Use bool for snd_seq_queue internal flags

PATCH New Takashi Iwai 1 participant 1 message Dec 6, 2020 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: seq: Use bool for snd_seq_queue internal flags

The snd_seq_queue struct contains various flags in the bit fields. Those are categorized to two different use cases, both of which are protected by different spinlocks. That implies that there are still potential risks of the bad operations for bit fields by concurrent accesses.

For addressing the problem, this patch rearranges those flags to be a standard bool instead of a bit field.

---
 sound/core/seq/seq_queue.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/core/seq/seq_queue.h +4 -4
index 1c3a8d3254d9..c69105dc1a10 100644
@@ -26,10 +26,10 @@ struct snd_seq_queue {
 	
 	struct snd_seq_timer *timer;	/* time keeper for this queue */
 	int	owner;		/* client that 'owns' the timer */
-	unsigned int	locked:1,	/* timer is only accesibble by owner if set */
-		klocked:1,	/* kernel lock (after START) */	
-		check_again:1,
-		check_blocked:1;
+	bool	locked;		/* timer is only accesibble by owner if set */
+	bool	klocked;	/* kernel lock (after START) */
+	bool	check_again;	/* concurrent access happened during check */
+	bool	check_blocked;	/* queue being checked */
 
 	unsigned int flags;		/* status flags */
 	unsigned int info_flags;	/* info for sync */
Signature · 1 line
2.26.2