On Tue, Jul 4, 2023 at 5:51 AM Luck, Tony <tony.luck@xxxxxxxxx> wrote: > > > > UBSAN complains this error > > > ~~~ > > > UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16 > > … > > > ~~~ > > > > > > when get rows, cols and ranks, the returned error value doesn't be > > > handled. > > > > > > check the return value is EINVAL, if yes, directly return 0. > > … > > > > * Please improve this change description further. > > To be specific. Initially you reported this because of the UBSAN error > report. But, after community discussion you now know that the problem > is that one or more of the rows/cols/ranks has a value that the EDAC driver > doesn't expect and probably can handle. > > So, in V2, the commit message should start with the information these > values are out of range and mention this was discovered when UBSAN > put out a warning about a negative shift. No need to include the whole > of the UBSAN stack trace. > > Then describe the two fixes that this patch includes. One is to change the > edac debug message into a console error message to enable further > debug of this issue. The other is to skip the unrecognized DIMM. > > > * How do you think about to add the tag “Fixes”? > > This is a good idea. Use git blame, or dig into the GIT history to > find the commit where this code was introduced (hint .. git blame > says: > 88a242c98740 ("EDAC, skx_common: Separate common code out from skx_edac") > but that obviously just refactored code, so you should dig back more into > the history. > > > > V2: make error-print explicitly > > > --- > > > > Would you like to avoid a misplaced marker line here? > > > > See also: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4#n686 > > That's an excellent resource. Thanks for your advices and I will modify. here's part of dmesg enabled EDAC_DEBUG ~~~ [ 4.032332] EDAC DEBUG: skx_register_mci: MC#1: mci = 00000000799db99e [ 4.032334] EDAC DEBUG: i10nm_get_dimm_config: dimmmtr 0xffffffff mcddrtcfg 0xffffffff (mc1 ch0 dimm0) [ 4.032335] EDAC DEBUG: skx_get_dimm_attr: bad ranks = 3 (raw=0xffffffff) [ 4.032337] EDAC DEBUG: skx_get_dimm_attr: bad rows = 7 (raw=0xffffffff) [ 4.032338] EDAC DEBUG: skx_get_dimm_attr: bad cols = 3 (raw=0xffffffff) [ 4.032339] EDAC DEBUG: i10nm_get_dimm_config: dimmmtr 0xffffffff mcddrtcfg 0xffffffff (mc1 ch0 dimm1) [ 4.032340] EDAC DEBUG: skx_get_dimm_attr: bad ranks = 3 (raw=0xffffffff) [ 4.032341] EDAC DEBUG: skx_get_dimm_attr: bad rows = 7 (raw=0xffffffff) [ 4.032341] EDAC DEBUG: skx_get_dimm_attr: bad cols = 3 (raw=0xffffffff) [ 4.032343] EDAC DEBUG: i10nm_get_dimm_config: dimmmtr 0xffffffff mcddrtcfg 0xffffffff (mc1 ch1 dimm0) [ 4.032344] EDAC DEBUG: skx_get_dimm_attr: bad ranks = 3 (raw=0xffffffff) [ 4.032345] EDAC DEBUG: skx_get_dimm_attr: bad rows = 7 (raw=0xffffffff) [ 4.032346] EDAC DEBUG: skx_get_dimm_attr: bad cols = 3 (raw=0xffffffff) [ 4.032347] EDAC DEBUG: i10nm_get_dimm_config: dimmmtr 0xffffffff mcddrtcfg 0xffffffff (mc1 ch1 dimm1) [ 4.032348] EDAC DEBUG: skx_get_dimm_attr: bad ranks = 3 (raw=0xffffffff) [ 4.032349] EDAC DEBUG: skx_get_dimm_attr: bad rows = 7 (raw=0xffffffff) [ 4.032349] EDAC DEBUG: skx_get_dimm_attr: bad cols = 3 (raw=0xffffffff) ~~~ I shared the whole dmesg through g-drive. https://drive.google.com/file/d/1epnDZNezGiJsK1eT4UNOi8_igcBSXtiF/view?usp=sharing > > -Tony