Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-20 Thread Shaobo He
Thank you very much for your reply. Do you mean if I track the argument to the callers, I should be able to figure out that the pin is always valid? I think I have two questions for this approach. First, does it mean that the branch returning NULL is practically dead code? Second, the driver cod

Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-19 Thread Rodrigo Vivi
On Tue, Mar 19, 2019 at 10:53:53AM -0600, Shaobo He wrote: > Thank you very much for your reply. Do you mean if I track the argument to > the callers, I should be able to figure out that the pin is always valid? I > think I have two questions for this approach. First, does it mean that the > branch

[Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-19 Thread Shaobo He
Hello everyone, My name is Shaobo He and I am a graduate student at University of Utah. I am using a static analysis tool to search for null pointer dereferences and came across a potentially invalid memory access in the file drivers/gpu/drm/i915/intel_crt.c: in function `intel_crt_detect_ddc`

Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-19 Thread Shaobo He
I see. In light of this commit, is it a better solution than adding NULL-checks is to replace the if branch conditioned by `WARN_ON` with simply `WARN` like the following, struct i2c_adapter *intel_gmbus_get_adapter(struct drm_i915_private *dev_priv,

Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-19 Thread Shaobo He
Hi Rodrigo, Sorry I'm a bit lost here. May I ask where the `WARN` is? Thanks, Shaobo On 3/18/19 5:26 PM, Rodrigo Vivi wrote: Hi Shaobo, n Mon, Mar 18, 2019 at 05:01:10PM -0600, Shaobo He wrote: Hello everyone, My name is Shaobo He and I am a graduate student at University of Utah. I am using

Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-19 Thread Jani Nikula
On Mon, 18 Mar 2019, Shaobo He wrote: > I see. In light of this commit, is it a better solution than adding > NULL-checks > is to replace the if branch conditioned by `WARN_ON` with simply `WARN` like > the > following, > > struct i2c_adapter *intel_gmbus_get_adapter(struct drm_i915_private *d

Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-18 Thread Rodrigo Vivi
On Mon, Mar 18, 2019 at 05:39:48PM -0600, Shaobo He wrote: > Hi Rodrigo, > > Sorry I'm a bit lost here. May I ask where the `WARN` is? along with the return NULL struct i2c_adapter *intel_gmbus_get_adapte() if (WARN_ON(!intel_gmbus_is_valid_pin(dev_priv, pin))) return NULL; > >

Re: [Intel-gfx] Potential NULL pointer dereference in intel_crt_get_edid

2019-03-18 Thread Rodrigo Vivi
Hi Shaobo, n Mon, Mar 18, 2019 at 05:01:10PM -0600, Shaobo He wrote: > Hello everyone, > > My name is Shaobo He and I am a graduate student at University of Utah. I am > using a static analysis tool to search for null pointer dereferences and > came across a potentially invalid memory access in t