ALSA: opl3: Fix possible negative array index access

Spotted by coverity CID 115196.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: pcsp: Fix initialization with nopcm=1

When nopcm=1 is set, some initializations based on hrtimer resolution
might be bogus because the driver checks the resolution only when
nopcm=0.  Simply get the resolution always at first for fixing the
bug.

Spotted by coverity CID 139740.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Limit the fallback card id string size

When no proper id string is given, the driver tries to fall back to
copy the proc_root name string via strcpy(), but this might overflow
the fixed string size.  Let's use strlcpy().

Spotted by coverity CID 139008.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Use strlcpy() instead of strncpy()

We tend to make stupid mistakes with strncpy().  Let's take a safer
one, strlcpy().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ad1889: Fix right attenuation proc output

The right attenuation bits aren't needed to be shifted.

Spotted by coverity CID 11427.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ali5451: Drop unused variable

The variable runtime is never used, and this might be even a source of
NULL-dereference.  Nothing better than killing it.

Spotted by coverity CID 100862.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: rme96: Return error code in PCM copy ops

Just pass the error code returned from copy_from_user_toio() and
copy_to_user_fromio() helpers.

Spotted by coverity CID 114119.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ak4114: Fix wrong register array size

The size of the register cache array is actually 6 instead of 7,
as it caches up to AK4114_REG_INT1_MASK.  This resulted in unexpected
access out of array range, although most of them aren't so serious
(just reading one more byte on the stack at snd_ak4114_create()).

Also, the check of cache size was wrongly done by checking with
sizeof() instead of ARRAY_SIZE().  Fixed this together.

(And yes, hardcoded numbers are bad, but I keep the coding style as is
 for making it clear what this patch actually does.)

Spotted by coverity among several CIDs, e.g. 711621.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ice1724: Fix uninitialized variable access

Spotted by coverity CIDs 751505 and 751506.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: lola: Fix uninitialized variable access in error message

The FUNCTION_TYPE parameter isn't associated with any NID, thus
showing the uninitialized nid in the error message is simply
nonsense.

Spotted by coverity CID 145068.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Disable AA-loopback on ALC283 Chromebook

ALC283-based Chromebook suffers from occasional white noise, and it
turned out that this comes from AA-loopback.  Disable this output path
by just clearing mixer_nid, then the generic parser will skip the
creation of AA-loopback path.

Reported-and-tested-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Add a fixup for ASUS N76VZ

ASUS N76VZ needs the same fixup as N56VZ for supporting the boost
speaker.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=846529
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-linus' into for-next
ALSA: hda - Add extra chmap for 2.1 outputs on ASUS laptops

ASUS N56VZ and N76VZ laptops have a bass speaker but its output comes
only from the right channel.  This patch adds the extra chmap specific
to these models.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=846531
Signed-off-by: Takashi Iwai <tiwai@suse.de>