Re: [PATCH] s390: net: qeth_core_main.c: Fix for possible null pointer dereference
From: Frank Blaschka
Date: Mon May 19 2014 - 04:30:26 EST
On Sun, May 18, 2014 at 06:04:27PM +0200, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
>
> Was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Added to my patch queue. Thx!
> ---
> drivers/s390/net/qeth_core_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
> index 22470a3..5562665 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -1012,7 +1012,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev,
>
> card = CARD_FROM_CDEV(cdev);
>
> - if (!IS_ERR(irb))
> + if (!card || !IS_ERR(irb))
> return 0;
>
> switch (PTR_ERR(irb)) {
> @@ -1028,7 +1028,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev,
> QETH_CARD_TEXT(card, 2, "ckirberr");
> QETH_CARD_TEXT_(card, 2, " rc%d", -ETIMEDOUT);
> if (intparm == QETH_RCD_PARM) {
> - if (card && (card->data.ccwdev == cdev)) {
> + if (card->data.ccwdev == cdev) {
> card->data.state = CH_STATE_DOWN;
> wake_up(&card->wait_q);
> }
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/