Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-13 Thread Dan Carpenter
This patch works but it's nasty to re-intialize "reg" inside both if else statements. Just do it once at the begining of the function. That means we would also delete the ininitialization from the if side of the if else statement: if (devpriv->model == VMK8061_MODEL) { -

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-13 Thread Ian Abbott
On 2013-02-13 11:56, Ian Abbott wrote: For a digital output subdevice, you could either read back the current values directly from the hardware or just use the value previously written. The Velleman K8055 doesn't have a command to read back the digital outputs from the hardware, so the last

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-13 Thread Ian Abbott
On 2013-02-13 07:32, Dan Carpenter wrote: On Wed, Feb 13, 2013 at 04:30:54AM +0100, Peter Huewe wrote: In vmk80xx_do_insn_bits the local variable reg, which is used as an index to the tx_buf array, can be used uninitialized if - data[0] == 0 and - devpriv->model != VMK8061_MODEL -> we get into

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-13 Thread Ian Abbott
On 2013-02-13 07:32, Dan Carpenter wrote: On Wed, Feb 13, 2013 at 04:30:54AM +0100, Peter Huewe wrote: In vmk80xx_do_insn_bits the local variable reg, which is used as an index to the tx_buf array, can be used uninitialized if - data[0] == 0 and - devpriv-model != VMK8061_MODEL - we get into

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-13 Thread Ian Abbott
On 2013-02-13 11:56, Ian Abbott wrote: For a digital output subdevice, you could either read back the current values directly from the hardware or just use the value previously written. The Velleman K8055 doesn't have a command to read back the digital outputs from the hardware, so the last

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-13 Thread Dan Carpenter
This patch works but it's nasty to re-intialize reg inside both if else statements. Just do it once at the begining of the function. That means we would also delete the ininitialization from the if side of the if else statement: if (devpriv-model == VMK8061_MODEL) { - reg

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-12 Thread Dan Carpenter
On Wed, Feb 13, 2013 at 04:30:54AM +0100, Peter Huewe wrote: > In vmk80xx_do_insn_bits the local variable reg, which is used as an > index to the tx_buf array, can be used uninitialized if > - data[0] == 0 > and > - devpriv->model != VMK8061_MODEL > -> we get into the else branch without having

[PATCH] staging/comedi: Fix undefined array subscript

2013-02-12 Thread Peter Huewe
In vmk80xx_do_insn_bits the local variable reg, which is used as an index to the tx_buf array, can be used uninitialized if - data[0] == 0 and - devpriv->model != VMK8061_MODEL -> we get into the else branch without having reg initialized. Since the driver usually differentiates between

[PATCH] staging/comedi: Fix undefined array subscript

2013-02-12 Thread Peter Huewe
In vmk80xx_do_insn_bits the local variable reg, which is used as an index to the tx_buf array, can be used uninitialized if - data[0] == 0 and - devpriv-model != VMK8061_MODEL - we get into the else branch without having reg initialized. Since the driver usually differentiates between

Re: [PATCH] staging/comedi: Fix undefined array subscript

2013-02-12 Thread Dan Carpenter
On Wed, Feb 13, 2013 at 04:30:54AM +0100, Peter Huewe wrote: In vmk80xx_do_insn_bits the local variable reg, which is used as an index to the tx_buf array, can be used uninitialized if - data[0] == 0 and - devpriv-model != VMK8061_MODEL - we get into the else branch without having reg