* [PATCH] s390: net: qeth_core_main.c: Fix for possible null pointer dereference
@ 2014-05-18 16:04 Rickard Strandqvist
2014-05-19 8:30 ` Frank Blaschka
0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-05-18 16:04 UTC (permalink / raw)
To: Ursula Braun, Frank Blaschka
Cc: Rickard Strandqvist, linux390, Martin Schwidefsky, Heiko Carstens,
linux-s390, linux-kernel
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@spectrumdigital.se>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] s390: net: qeth_core_main.c: Fix for possible null pointer dereference
2014-05-18 16:04 [PATCH] s390: net: qeth_core_main.c: Fix for possible null pointer dereference Rickard Strandqvist
@ 2014-05-19 8:30 ` Frank Blaschka
0 siblings, 0 replies; 2+ messages in thread
From: Frank Blaschka @ 2014-05-19 8:30 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Ursula Braun, linux390, Martin Schwidefsky, Heiko Carstens,
linux-s390, linux-kernel
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@spectrumdigital.se>
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-19 8:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-18 16:04 [PATCH] s390: net: qeth_core_main.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-05-19 8:30 ` Frank Blaschka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).