Messages in this thread | | | Date | Thu, 10 Feb 2022 15:59:28 +0800 | Subject | [oracle-dtrace:v2/5.17-rc2 8/10] fs/eventpoll.c:1224:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg] | From | kernel test robot <> |
| |
tree: https://github.com/oracle/dtrace-linux-kernel v2/5.17-rc2 head: 47946e7b2e2319f39cbb7f8aaa294298c2dec5b4 commit: 16ad67b61ac4f3dd93b3fa6875a011fff7b88500 [8/10] waitfd: new syscall implementing waitpid() over fds compiler: or1k-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not be real problems)
>> fs/eventpoll.c:1224:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg] key = (void *)epi->fixed_event; ^
vim +1224 fs/eventpoll.c
a218cc4914209a Roman Penyaev 2019-03-07 1118 ^1da177e4c3f41 Linus Torvalds 2005-04-16 1119 /* 7699acd1341c63 Davide Libenzi 2007-05-10 1120 * This is the callback that is passed to the wait queue wakeup bf6a41db7726e6 Daniel Baluta 2011-01-30 1121 * mechanism. It is called by the stored file descriptors when they 7699acd1341c63 Davide Libenzi 2007-05-10 1122 * have events to report. a218cc4914209a Roman Penyaev 2019-03-07 1123 * a6c67fee9cf095 Randy Dunlap 2021-03-01 1124 * This callback takes a read lock in order not to contend with concurrent a6c67fee9cf095 Randy Dunlap 2021-03-01 1125 * events from another file descriptor, thus all modifications to ->rdllist a218cc4914209a Roman Penyaev 2019-03-07 1126 * or ->ovflist are lockless. Read lock is paired with the write lock from a218cc4914209a Roman Penyaev 2019-03-07 1127 * ep_scan_ready_list(), which stops all list modifications and guarantees a218cc4914209a Roman Penyaev 2019-03-07 1128 * that lists state is seen correctly. a218cc4914209a Roman Penyaev 2019-03-07 1129 * a218cc4914209a Roman Penyaev 2019-03-07 1130 * Another thing worth to mention is that ep_poll_callback() can be called a218cc4914209a Roman Penyaev 2019-03-07 1131 * concurrently for the same @epi from different CPUs if poll table was inited a218cc4914209a Roman Penyaev 2019-03-07 1132 * with several wait queues entries. Plural wakeup from different CPUs of a a218cc4914209a Roman Penyaev 2019-03-07 1133 * single wait queue is serialized by wq.lock, but the case when multiple wait a218cc4914209a Roman Penyaev 2019-03-07 1134 * queues are used should be detected accordingly. This is detected using a218cc4914209a Roman Penyaev 2019-03-07 1135 * cmpxchg() operation. ^1da177e4c3f41 Linus Torvalds 2005-04-16 1136 */ ac6424b981bce1 Ingo Molnar 2017-06-20 1137 static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) ^1da177e4c3f41 Linus Torvalds 2005-04-16 1138 { 7699acd1341c63 Davide Libenzi 2007-05-10 1139 int pwake = 0; 7699acd1341c63 Davide Libenzi 2007-05-10 1140 struct epitem *epi = ep_item_from_wait(wait); 7699acd1341c63 Davide Libenzi 2007-05-10 1141 struct eventpoll *ep = epi->ep; 3ad6f93e98d6df Al Viro 2017-07-03 1142 __poll_t pollflags = key_to_poll(key); a218cc4914209a Roman Penyaev 2019-03-07 1143 unsigned long flags; df0108c5da561c Jason Baron 2016-01-20 1144 int ewake = 0; ^1da177e4c3f41 Linus Torvalds 2005-04-16 1145 a218cc4914209a Roman Penyaev 2019-03-07 1146 read_lock_irqsave(&ep->lock, flags); ^1da177e4c3f41 Linus Torvalds 2005-04-16 1147 bf3b9f6372c45b Sridhar Samudrala 2017-03-24 1148 ep_set_busy_poll_napi_id(epi); bf3b9f6372c45b Sridhar Samudrala 2017-03-24 1149 ^1da177e4c3f41 Linus Torvalds 2005-04-16 1150 /* 7699acd1341c63 Davide Libenzi 2007-05-10 1151 * If the event mask does not contain any poll(2) event, we consider the 7699acd1341c63 Davide Libenzi 2007-05-10 1152 * descriptor to be disabled. This condition is likely the effect of the 7699acd1341c63 Davide Libenzi 2007-05-10 1153 * EPOLLONESHOT bit that disables the descriptor when an event is received, 7699acd1341c63 Davide Libenzi 2007-05-10 1154 * until the next EPOLL_CTL_MOD will be issued. ^1da177e4c3f41 Linus Torvalds 2005-04-16 1155 */ 7699acd1341c63 Davide Libenzi 2007-05-10 1156 if (!(epi->event.events & ~EP_PRIVATE_BITS)) d47de16c722196 Davide Libenzi 2007-05-15 1157 goto out_unlock; d47de16c722196 Davide Libenzi 2007-05-15 1158 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1159 /* 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1160 * Check the events coming with the callback. At this stage, not 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1161 * every device reports the events in the "key" parameter of the 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1162 * callback. We need to be able to handle both cases here, hence the 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1163 * test for "key" != NULL before the event match test. 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1164 */ 3ad6f93e98d6df Al Viro 2017-07-03 1165 if (pollflags && !(pollflags & epi->event.events)) 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1166 goto out_unlock; 2dfa4eeab0fc7e Davide Libenzi 2009-03-31 1167 d47de16c722196 Davide Libenzi 2007-05-15 1168 /* bf6a41db7726e6 Daniel Baluta 2011-01-30 1169 * If we are transferring events to userspace, we can hold no locks d47de16c722196 Davide Libenzi 2007-05-15 1170 * (because we're accessing user memory, and because of linux f_op->poll() bf6a41db7726e6 Daniel Baluta 2011-01-30 1171 * semantics). All the events that happen during that period of time are d47de16c722196 Davide Libenzi 2007-05-15 1172 * chained in ep->ovflist and requeued later on. d47de16c722196 Davide Libenzi 2007-05-15 1173 */ c5a282e9635e9c Davidlohr Bueso 2019-01-03 1174 if (READ_ONCE(ep->ovflist) != EP_UNACTIVE_PTR) { 0c54a6a44bf3d4 Khazhismel Kumykov 2020-05-07 1175 if (chain_epi_lockless(epi)) c3e320b61581ef Roman Penyaev 2019-03-07 1176 ep_pm_stay_awake_rcu(epi); 0c54a6a44bf3d4 Khazhismel Kumykov 2020-05-07 1177 } else if (!ep_is_linked(epi)) { 0c54a6a44bf3d4 Khazhismel Kumykov 2020-05-07 1178 /* In the usual case, add event to ready list. */ 0c54a6a44bf3d4 Khazhismel Kumykov 2020-05-07 1179 if (list_add_tail_lockless(&epi->rdllink, &ep->rdllist)) eea1d585917c53 Eric Wong 2013-04-30 1180 ep_pm_stay_awake_rcu(epi); 4d7e30d98939a0 Arve Hjønnevåg 2012-05-01 1181 } 7699acd1341c63 Davide Libenzi 2007-05-10 1182 7699acd1341c63 Davide Libenzi 2007-05-10 1183 /* 7699acd1341c63 Davide Libenzi 2007-05-10 1184 * Wake up ( if active ) both the eventpoll wait list and the ->poll() 7699acd1341c63 Davide Libenzi 2007-05-10 1185 * wait list. 7699acd1341c63 Davide Libenzi 2007-05-10 1186 */ df0108c5da561c Jason Baron 2016-01-20 1187 if (waitqueue_active(&ep->wq)) { b6a515c8a0f6c2 Jason Baron 2016-02-05 1188 if ((epi->event.events & EPOLLEXCLUSIVE) && 3ad6f93e98d6df Al Viro 2017-07-03 1189 !(pollflags & POLLFREE)) { 3ad6f93e98d6df Al Viro 2017-07-03 1190 switch (pollflags & EPOLLINOUT_BITS) { a9a08845e9acbd Linus Torvalds 2018-02-11 1191 case EPOLLIN: a9a08845e9acbd Linus Torvalds 2018-02-11 1192 if (epi->event.events & EPOLLIN) b6a515c8a0f6c2 Jason Baron 2016-02-05 1193 ewake = 1; b6a515c8a0f6c2 Jason Baron 2016-02-05 1194 break; a9a08845e9acbd Linus Torvalds 2018-02-11 1195 case EPOLLOUT: a9a08845e9acbd Linus Torvalds 2018-02-11 1196 if (epi->event.events & EPOLLOUT) b6a515c8a0f6c2 Jason Baron 2016-02-05 1197 ewake = 1; b6a515c8a0f6c2 Jason Baron 2016-02-05 1198 break; b6a515c8a0f6c2 Jason Baron 2016-02-05 1199 case 0: df0108c5da561c Jason Baron 2016-01-20 1200 ewake = 1; b6a515c8a0f6c2 Jason Baron 2016-02-05 1201 break; b6a515c8a0f6c2 Jason Baron 2016-02-05 1202 } b6a515c8a0f6c2 Jason Baron 2016-02-05 1203 } a218cc4914209a Roman Penyaev 2019-03-07 1204 wake_up(&ep->wq); df0108c5da561c Jason Baron 2016-01-20 1205 } 7699acd1341c63 Davide Libenzi 2007-05-10 1206 if (waitqueue_active(&ep->poll_wait)) 7699acd1341c63 Davide Libenzi 2007-05-10 1207 pwake++; ^1da177e4c3f41 Linus Torvalds 2005-04-16 1208 d47de16c722196 Davide Libenzi 2007-05-15 1209 out_unlock: a218cc4914209a Roman Penyaev 2019-03-07 1210 read_unlock_irqrestore(&ep->lock, flags); 7699acd1341c63 Davide Libenzi 2007-05-10 1211 7699acd1341c63 Davide Libenzi 2007-05-10 1212 /* We have to call this outside the lock */ 7699acd1341c63 Davide Libenzi 2007-05-10 1213 if (pwake) efcdd350d1f8a9 Jason Baron 2020-04-06 1214 ep_poll_safewake(ep, epi); 7699acd1341c63 Davide Libenzi 2007-05-10 1215 138e4ad67afd5c Oleg Nesterov 2017-09-01 1216 if (!(epi->event.events & EPOLLEXCLUSIVE)) 138e4ad67afd5c Oleg Nesterov 2017-09-01 1217 ewake = 1; 138e4ad67afd5c Oleg Nesterov 2017-09-01 1218 16ad67b61ac4f3 Nick Alcock 2018-11-14 1219 /* 16ad67b61ac4f3 Nick Alcock 2018-11-14 1220 * If this fd type has a hardwired event which should override the key 16ad67b61ac4f3 Nick Alcock 2018-11-14 1221 * (e.g. if it is waiting on a non-file waitqueue), jam it in here. 16ad67b61ac4f3 Nick Alcock 2018-11-14 1222 */ 16ad67b61ac4f3 Nick Alcock 2018-11-14 1223 if (epi->fixed_event) 16ad67b61ac4f3 Nick Alcock 2018-11-14 @1224 key = (void *)epi->fixed_event; 16ad67b61ac4f3 Nick Alcock 2018-11-14 1225 3ad6f93e98d6df Al Viro 2017-07-03 1226 if (pollflags & POLLFREE) { 138e4ad67afd5c Oleg Nesterov 2017-09-01 1227 /* 138e4ad67afd5c Oleg Nesterov 2017-09-01 1228 * If we race with ep_remove_wait_queue() it can miss 138e4ad67afd5c Oleg Nesterov 2017-09-01 1229 * ->whead = NULL and do another remove_wait_queue() after 138e4ad67afd5c Oleg Nesterov 2017-09-01 1230 * us, so we can't use __remove_wait_queue(). 138e4ad67afd5c Oleg Nesterov 2017-09-01 1231 */ 138e4ad67afd5c Oleg Nesterov 2017-09-01 1232 list_del_init(&wait->entry); 138e4ad67afd5c Oleg Nesterov 2017-09-01 1233 /* 138e4ad67afd5c Oleg Nesterov 2017-09-01 1234 * ->whead != NULL protects us from the race with ep_free() 138e4ad67afd5c Oleg Nesterov 2017-09-01 1235 * or ep_remove(), ep_remove_wait_queue() takes whead->lock 138e4ad67afd5c Oleg Nesterov 2017-09-01 1236 * held by the caller. Once we nullify it, nothing protects 138e4ad67afd5c Oleg Nesterov 2017-09-01 1237 * ep/epi or even wait. 138e4ad67afd5c Oleg Nesterov 2017-09-01 1238 */ 138e4ad67afd5c Oleg Nesterov 2017-09-01 1239 smp_store_release(&ep_pwq_from_wait(wait)->whead, NULL); 138e4ad67afd5c Oleg Nesterov 2017-09-01 1240 } df0108c5da561c Jason Baron 2016-01-20 1241 138e4ad67afd5c Oleg Nesterov 2017-09-01 1242 return ewake; 7699acd1341c63 Davide Libenzi 2007-05-10 1243 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 1244
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
| |