EDAC: Fix sysfs dimm_label show operation
EDAC: Fix sysfs dimm_label show operation

After

  7d375bffa524 ("sb_edac: Fix support for systems with two home agents per socket")

sysfs "dimm_label" and "chX_dimm_label" show their label string without a
newline "\n" at the end.

  [root@orange ~]# cat /sys/bus/mc0/devices/dimm0/dimm_label
  CPU_SrcID#0_Ha#0_Chan#0_DIMM#0[root@orange ~]#

  [root@orange ~]# cat /sys/devices/system/edac/mc/mc0/csrow0/ch0_dimm_label
  CPU_SrcID#0_Ha#0_Chan#0_DIMM#0[root@orange ~]#

The label strings now have 31 characters, which are the same as
EDAC_MC_LABEL_LEN. Since the snprintf()s in channel_dimm_label_show()
and dimmdev_label_show() limit the whole length by EDAC_MC_LABEL_LEN,
the newline in the format "%s\n" is ignored.

  [root@orange ~]# od -bc /sys/bus/mc0/devices/dimm0/dimm_label
  0000000 103 120 125 137 123 162 143 111 104 043 060 137 110 141 043 060
            C   P   U   _   S   r   c   I   D   #   0   _   H   a   #   0
  0000020 137 103 150 141 156 043 060 137 104 111 115 115 043 060 000
            _   C   h   a   n   #   0   _   D   I   M   M   #   0  \0
  0000037

Fix it by using 'sizeof(dimm->label) + 1' as the whole length in the
snprintf()s in channel_dimm_label_show() and dimmdev_label_show().

Reported-by: Robert Elliott <fcf6aac10c16bf4310224494560ff8cb9772fa2e@hpe.com>
Signed-off-by: Toshi Kani <322b9f75d3806917607539efc168804d71b9503d@hpe.com>
Acked-by: Tony Luck <e7984595ec0368ff920a7b3521dc7093683f6f26@intel.com>
Cc: linux-edac <2f2877799b28945e915fed027ea960f3cffe53dd@vger.kernel.org>
Cc: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@osg.samsung.com>
Link: http://lkml.kernel.org/r/1442933883-21587-2-git-send-email-322b9f75d3806917607539efc168804d71b9503d@hpe.com
Signed-off-by: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@suse.de>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs