linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* static analysis bug report: ALSA: swapped client and port arguments in calls to snd_seq_oss_fill_addr
@ 2019-06-27 14:01 Colin Ian King
  2019-06-28  9:22 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2019-06-27 14:01 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, alsa-devel; +Cc: linux-kernel

Hi there,

Static analysis with Coverity has picked up two potential issues with
the call to function snd_seq_oss_fill_addr. The prototype of
snd_seq_oss_fill_addr is as follows:

static inline void
snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event
*ev,int dest_client, int dest_port)


However, in sound/core/seq/oss/seq_oss_ioctl.c in function
snd_seq_oss_oob_user it is being called as follows:

	 snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.port, dp->addr.client);

and also in sound/core/seq/oss/seq_oss_rw.c in function is it also being
called as follows:

	snd_seq_oss_fill_addr(dp, &event, dp->addr.port, dp->addr.client);

..as one can see, in both cases the port and client arguments are
swapped compared to the function prototype.  I doubt this is intentional
but you never know. Are these bugs?

Colin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: static analysis bug report: ALSA: swapped client and port arguments in calls to snd_seq_oss_fill_addr
  2019-06-27 14:01 static analysis bug report: ALSA: swapped client and port arguments in calls to snd_seq_oss_fill_addr Colin Ian King
@ 2019-06-28  9:22 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-06-28  9:22 UTC (permalink / raw)
  To: Colin Ian King; +Cc: alsa-devel, Jaroslav Kysela, linux-kernel

On Thu, 27 Jun 2019 16:01:40 +0200,
Colin Ian King wrote:
> 
> Hi there,
> 
> Static analysis with Coverity has picked up two potential issues with
> the call to function snd_seq_oss_fill_addr. The prototype of
> snd_seq_oss_fill_addr is as follows:
> 
> static inline void
> snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event
> *ev,int dest_client, int dest_port)
> 
> 
> However, in sound/core/seq/oss/seq_oss_ioctl.c in function
> snd_seq_oss_oob_user it is being called as follows:
> 
> 	 snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.port, dp->addr.client);
> 
> and also in sound/core/seq/oss/seq_oss_rw.c in function is it also being
> called as follows:
> 
> 	snd_seq_oss_fill_addr(dp, &event, dp->addr.port, dp->addr.client);
> 
> ..as one can see, in both cases the port and client arguments are
> swapped compared to the function prototype.  I doubt this is intentional
> but you never know. Are these bugs?

That's a clear bug, the order should be (client, port), so it's bugs
in the caller side.  They are rare use case, so probably no one really
hits or is annoyed -- the latter is a note-off just to be sure, and
the former is a special ioctl probably that has been never used :)

In anyway, would you send me a fix patch?


Thanks!

Takashi

> 
> Colin
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-28  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 14:01 static analysis bug report: ALSA: swapped client and port arguments in calls to snd_seq_oss_fill_addr Colin Ian King
2019-06-28  9:22 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).