Skip to content

Commit dfa9a5e

Browse files
committed
ALSA: rawmidi: Avoid bit fields for state flags
The rawmidi state flags (opened, append, active_sensing) are stored in bit fields that can be potentially racy when concurrently accessed without any locks. Although the current code should be fine, there is also no any real benefit by keeping the bitfields for this kind of short number of members. This patch changes those bit fields flags to the simple bool fields. There should be no size increase of the snd_rawmidi_substream by this change. Reported-by: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent dc74977 commit dfa9a5e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/sound/rawmidi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ struct snd_rawmidi_substream {
7777
struct list_head list; /* list of all substream for given stream */
7878
int stream; /* direction */
7979
int number; /* substream number */
80-
unsigned int opened: 1, /* open flag */
81-
append: 1, /* append flag (merge more streams) */
82-
active_sensing: 1; /* send active sensing when close */
80+
bool opened; /* open flag */
81+
bool append; /* append flag (merge more streams) */
82+
bool active_sensing; /* send active sensing when close */
8383
int use_count; /* use counter (for output) */
8484
size_t bytes;
8585
struct snd_rawmidi *rmidi;

0 commit comments

Comments
 (0)