Patch "s390: ctcm: fix ctcm_new_device error return code" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390: ctcm: fix ctcm_new_device error return code

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-ctcm-fix-ctcm_new_device-error-return-code.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a9e4932478ff9587c71564400ecf138f3eac6426
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date:   Wed Apr 17 18:29:13 2019 +0200

    s390: ctcm: fix ctcm_new_device error return code
    
    [ Upstream commit 27b141fc234a3670d21bd742c35d7205d03cbb3a ]
    
    clang points out that the return code from this function is
    undefined for one of the error paths:
    
    ../drivers/s390/net/ctcm_main.c:1595:7: warning: variable 'result' is used uninitialized whenever 'if' condition is true
          [-Wsometimes-uninitialized]
                    if (priv->channel[direction] == NULL) {
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../drivers/s390/net/ctcm_main.c:1638:9: note: uninitialized use occurs here
            return result;
                   ^~~~~~
    ../drivers/s390/net/ctcm_main.c:1595:3: note: remove the 'if' if its condition is always false
                    if (priv->channel[direction] == NULL) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../drivers/s390/net/ctcm_main.c:1539:12: note: initialize the variable 'result' to silence this warning
            int result;
                      ^
    
    Make it return -ENODEV here, as in the related failure cases.
    gcc has a known bug in underreporting some of these warnings
    when it has already eliminated the assignment of the return code
    based on some earlier optimization step.
    
    Reviewed-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
    Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
    Signed-off-by: Julian Wiedmann <jwi@xxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 26363e0816fe4..fbe35c2ac8981 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1594,6 +1594,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)
 		if (priv->channel[direction] == NULL) {
 			if (direction == CTCM_WRITE)
 				channel_free(priv->channel[CTCM_READ]);
+			result = -ENODEV;
 			goto out_dev;
 		}
 		priv->channel[direction]->netdev = dev;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux