diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-07-18 14:48:10 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-07-18 18:55:11 +0300 |
commit | 5051735221ba50cb5794b9194a8ad10a13368f2f (patch) | |
tree | 002575b0085221e8b853c89da51c8044b28cfc9e /sound/pci/pcxhr/pcxhr.h | |
parent | 7ad210ace5c1701421a4defa9d9e830a6f2ee56b (diff) | |
download | linux-5051735221ba50cb5794b9194a8ad10a13368f2f.tar.xz |
ALSA: pcxhr: fix string overflow warnings
With gcc-7, we get a warning about a possible string overflow:
sound/pci/pcxhr/pcxhr.c: In function 'pcxhr_probe':
sound/pci/pcxhr/pcxhr.c:1647:28: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]
The shortname can simply be removed, and the longname can
be changed into a shorter "name" string that is used in three
places. Making it a little shorter (40 bytes) avoids the risk of
overflowing completely, but I also use snprintf() here for
extra clarity.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/pcxhr/pcxhr.h')
-rw-r--r-- | sound/pci/pcxhr/pcxhr.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 9e39e509a3ef..d799cbd37301 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h @@ -75,8 +75,7 @@ struct pcxhr_mgr { unsigned long port[3]; /* share the name */ - char shortname[32]; /* short name of this soundcard */ - char longname[96]; /* name of this soundcard */ + char name[40]; /* name of this soundcard */ struct pcxhr_rmh *prmh; |