All of lore.kernel.org
 help / color / mirror / Atom feed
* sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447, 449, 452, 457, 487)
       [not found] <50f065ed.AKRZpjBAgH1NKCEc%yuanhan.liu@linux.intel.com>
@ 2013-01-12  2:17 ` Fengguang Wu
  2013-01-12  7:47   ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Fengguang Wu @ 2013-01-12  2:17 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel


Hi Takashi,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git master
head:   02e5aa7b459f69538d4ec88658d064816a7692d6
commit: bea06a147981e88465f566acd6c6e98b297f7712 ALSA: hda - Protect user-defined arrays via mutex
date:   3 hours ago

sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447,449,452,457,487)

vim +487 sound/pci/hda/hda_hwdep.c

43b62713 Takashi Iwai       2009-03-02  441  	char *key, *val;
43b62713 Takashi Iwai       2009-03-02  442  	struct hda_hint *hint;
bea06a14 Takashi Iwai       2013-01-10  443  	int err = 0;
1e1be432 Takashi Iwai       2008-07-30  444  
e7d2860b André Goddard Rosa 2009-12-14  445  	buf = skip_spaces(buf);
43b62713 Takashi Iwai       2009-03-02  446  	if (!*buf || *buf == '#' || *buf == '\n')
4ea6fbc8 Takashi Iwai       2009-06-17 @447  		return 0;
43b62713 Takashi Iwai       2009-03-02  448  	if (*buf == '=')
43b62713 Takashi Iwai       2009-03-02 @449  		return -EINVAL;
43b62713 Takashi Iwai       2009-03-02  450  	key = kstrndup_noeol(buf, 1024);
43b62713 Takashi Iwai       2009-03-02  451  	if (!key)
1e1be432 Takashi Iwai       2008-07-30 @452  		return -ENOMEM;
43b62713 Takashi Iwai       2009-03-02  453  	/* extract key and val */
43b62713 Takashi Iwai       2009-03-02  454  	val = strchr(key, '=');
43b62713 Takashi Iwai       2009-03-02  455  	if (!val) {
43b62713 Takashi Iwai       2009-03-02  456  		kfree(key);
43b62713 Takashi Iwai       2009-03-02 @457  		return -EINVAL;
43b62713 Takashi Iwai       2009-03-02  458  	}
43b62713 Takashi Iwai       2009-03-02  459  	*val++ = 0;
e7d2860b André Goddard Rosa 2009-12-14  460  	val = skip_spaces(val);
43b62713 Takashi Iwai       2009-03-02  461  	remove_trail_spaces(key);
43b62713 Takashi Iwai       2009-03-02  462  	remove_trail_spaces(val);
bea06a14 Takashi Iwai       2013-01-10  463  	mutex_lock(&codec->user_mutex);
43b62713 Takashi Iwai       2009-03-02  464  	hint = get_hint(codec, key);
43b62713 Takashi Iwai       2009-03-02  465  	if (hint) {
43b62713 Takashi Iwai       2009-03-02  466  		/* replace */
43b62713 Takashi Iwai       2009-03-02  467  		kfree(hint->key);
43b62713 Takashi Iwai       2009-03-02  468  		hint->key = key;
43b62713 Takashi Iwai       2009-03-02  469  		hint->val = val;
bea06a14 Takashi Iwai       2013-01-10  470  		goto unlock;
43b62713 Takashi Iwai       2009-03-02  471  	}
43b62713 Takashi Iwai       2009-03-02  472  	/* allocate a new hint entry */
43b62713 Takashi Iwai       2009-03-02  473  	if (codec->hints.used >= MAX_HINTS)
43b62713 Takashi Iwai       2009-03-02  474  		hint = NULL;
43b62713 Takashi Iwai       2009-03-02  475  	else
43b62713 Takashi Iwai       2009-03-02  476  		hint = snd_array_new(&codec->hints);
1e1be432 Takashi Iwai       2008-07-30  477  	if (!hint) {
1e1be432 Takashi Iwai       2008-07-30 @478  		return -ENOMEM;
bea06a14 Takashi Iwai       2013-01-10  479  		goto unlock;
1e1be432 Takashi Iwai       2008-07-30  480  	}
43b62713 Takashi Iwai       2009-03-02  481  	hint->key = key;
43b62713 Takashi Iwai       2009-03-02  482  	hint->val = val;
bea06a14 Takashi Iwai       2013-01-10  483   unlock:
bea06a14 Takashi Iwai       2013-01-10  484  	mutex_unlock(&codec->user_mutex);
bea06a14 Takashi Iwai       2013-01-10  485  	if (err)
bea06a14 Takashi Iwai       2013-01-10  486  		kfree(key);
bea06a14 Takashi Iwai       2013-01-10 @487  	return err;
4ea6fbc8 Takashi Iwai       2009-06-17  488  }
4ea6fbc8 Takashi Iwai       2009-06-17  489  
4ea6fbc8 Takashi Iwai       2009-06-17  490  static ssize_t hints_store(struct device *dev,

---
0-DAY kernel build testing backend         Open Source Technology Center
Fengguang Wu, Yuanhan Liu                              Intel Corporation
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447, 449, 452, 457, 487)
  2013-01-12  2:17 ` sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447, 449, 452, 457, 487) Fengguang Wu
@ 2013-01-12  7:47   ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-01-12  7:47 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: alsa-devel

At Sat, 12 Jan 2013 10:17:57 +0800,
Fengguang Wu wrote:
> 
> 
> Hi Takashi,
> 
> FYI, there are new smatch warnings show up in
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git master
> head:   02e5aa7b459f69538d4ec88658d064816a7692d6
> commit: bea06a147981e88465f566acd6c6e98b297f7712 ALSA: hda - Protect user-defined arrays via mutex
> date:   3 hours ago
> 
> sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447,449,452,457,487)

Thanks!  All three bugs have been fixed now.
Since it's only in sound-unstable tree and it's the last commit,
I rebased the tree exceptionally.


Takashi

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

end of thread, other threads:[~2013-01-12  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <50f065ed.AKRZpjBAgH1NKCEc%yuanhan.liu@linux.intel.com>
2013-01-12  2:17 ` sound/pci/hda/hda_hwdep.c:487 parse_hints() warn: inconsistent returns mutex:&codec->user_mutex: locked (478) unlocked (447, 449, 452, 457, 487) Fengguang Wu
2013-01-12  7:47   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.