[PATCH] cxgb4: fix undefined behavior in mem.c

2019-02-28 Thread Shaobo He
In function `c4iw_dealloc_mw`, variable mhp's value is printed after freed, which triggers undefined behavior according to this post: https://trust-in-soft.com/dangling-pointer-indeterminate/. This commit fixes it by swapping the order of `kfree` and `pr_debug`. Signed-off-by: Shao

[PATCH] platform/sh_veu.c: remove redundant NULL pointer checks

2019-02-28 Thread Shaobo He
`. Signed-off-by: Shaobo He --- drivers/media/platform/sh_veu.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index 09ae64a..3069015 100644 --- a/drivers/media/platform/sh_veu.c +++ b/drivers/media/platform/sh_veu.c

Re: [PATCH] cxgb4: fix undefined behavior in mem.c

2019-02-28 Thread Shaobo He
I think maybe the more problematic issue is that the value of a freed pointer is intermediate. Shaobo On 2/28/19 3:56 PM, Bart Van Assche wrote: On Thu, 2019-02-28 at 15:38 -0700, Shaobo He wrote: In function `c4iw_dealloc_mw`, variable mhp's value is printed after freed, which triggers und

Re: [PATCH] cxgb4: fix undefined behavior in mem.c

2019-02-28 Thread Shaobo He
16:18 -0700, Shaobo He wrote: I can't afford a pdf version of the C standard. So I looked at the draft version used in the link I put in the commit message. It says (in 6.2.4:2), ``` The lifetime of an object is the portion of program execution during which storage is guaranteed to be reserve

Re: [PATCH] cxgb4: fix undefined behavior in mem.c

2019-03-01 Thread Shaobo He
simply makes it totally valid. If it can be finally submitted, that would be great. If not, I'm totally fine. Shaobo On 2019/3/1 7:26, Doug Ledford wrote: On Thu, 2019-02-28 at 16:57 -0700, Shaobo He wrote: Good catch. But if we agree on that memory management functions are those specified by t

[PATCH] Remove deductively redundant NULL pointer checks

2019-02-25 Thread Shaobo He
`v4l2_mem_get_vq`. Signed-off-by: Shaobo He --- drivers/media/platform/coda/coda-common.c | 4 drivers/media/platform/imx-pxp.c | 7 --- drivers/media/platform/m2m-deinterlace.c | 7 --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c| 7

[PATCH] Remove deductively redundant NULL pointer checks

2019-02-26 Thread Shaobo He
`v4l2_mem_get_vq`. Signed-off-by: Shaobo He --- drivers/media/platform/coda/coda-common.c | 4 drivers/media/platform/imx-pxp.c | 7 --- drivers/media/platform/m2m-deinterlace.c | 7 --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c| 7