Skip to contentSkip to conversation

Coverity: compat_ksys_shmctl(): Uninitialized variables

DISCUSSION coverity-bot 1 participant 1 message Apr 22, 2020 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hello!

This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20200422 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:

Sat Jul 8 22:52:47 2017 -0400

    553f770ef71b ("ipc: move compat shmctl to native")

Coverity reported the following:

*** CID 1492708: Uninitialized variables (UNINIT) /ipc/shm.c: 1347 in compat_ksys_shmctl()

1341     	}
1342     	case SHM_INFO: {
1343     		struct shm_info shm_info;
1344     		err = shmctl_shm_info(ns, &shm_info);
1345     		if (err < 0)
1346     			return err;
vvv     CID 1492708:  Uninitialized variables  (UNINIT)
vvv     Using uninitialized value "shm_info.swap_successes" when calling "put_compat_shm_info".
1347     		if (put_compat_shm_info(&shm_info, uptr))
1348     			err = -EFAULT;
1349     		return err;
1350     	}
1351     	case IPC_STAT:
1352     	case SHM_STAT_ANY:

If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):

Human edit:
This is technically a false-positive, but it's a weird one in that everything else in the call graph checks for "err" being "!= 0", but line 1345 checks for "< 0". Maybe this deserves a change to "if (err)" there just for robustness?

Addresses-Coverity-ID: 1492708 ("Uninitialized variables")

Fixes 553f770ef71b ("ipc: move compat shmctl to native")

Thanks for your attention!

Signature · 1 line
Coverity-bot