Re: kernel/workqueue.c:4434:61: sparse: expression using sizeof bool
Hey, On Thu, Apr 04, 2013 at 09:42:09AM +0800, Fengguang Wu wrote: > > > 4433/* copy worker description */ > > > > 4434probe_kernel_read(_valid, >desc_valid, > > > > sizeof(desc_valid)); > > > 4435if (desc_valid) > > > > I don't know what to make of this warning. Yes, it's probing a bool > > variable and of course using sizeof(bool) to do that. Why does sparse > > complain about this? > > I guess sparse warns on sizeof(bool) because it is compiler defined. > It may be 1, 4, or even 8 depending on the gcc version and platform. Yeah, it's copying out a bool so as long as that's the actual size, it's okay. I mean, it's not like sizeof(long) is constant across platforms. I'm gonna ignore it but still curious what the warning is good for. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: kernel/workqueue.c:4434:61: sparse: expression using sizeof bool
Hey, On Thu, Apr 04, 2013 at 09:42:09AM +0800, Fengguang Wu wrote: 4433/* copy worker description */ 4434probe_kernel_read(desc_valid, worker-desc_valid, sizeof(desc_valid)); 4435if (desc_valid) I don't know what to make of this warning. Yes, it's probing a bool variable and of course using sizeof(bool) to do that. Why does sparse complain about this? I guess sparse warns on sizeof(bool) because it is compiler defined. It may be 1, 4, or even 8 depending on the gcc version and platform. Yeah, it's copying out a bool so as long as that's the actual size, it's okay. I mean, it's not like sizeof(long) is constant across platforms. I'm gonna ignore it but still curious what the warning is good for. Thanks. -- tejun -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: kernel/workqueue.c:4434:61: sparse: expression using sizeof bool
CC Christopher and LKML. On Wed, Apr 03, 2013 at 02:57:18PM -0700, Tejun Heo wrote: > Hello, Fengguang. Hi Tejun! > On Sat, Mar 30, 2013 at 08:29:47PM +0800, kbuild test robot wrote: > > tree: git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git > > review-better-dbg > > head: ea44ca757342b769c176fd6d0b3fb525b22eeda9 > > commit: c04655aeae70173688bca4c62b35737ab6958e82 workqueue: include > > workqueue info when printing debug dump of a worker task > > date: 10 hours ago > > > > > > sparse warnings: (new ones prefixed by >>) > > > >kernel/workqueue.c:287:8: sparse: symbol 'cpu_worker_pools' was not > > declared. Should it be static? > >kernel/workqueue.c:300:25: sparse: symbol 'system_highpri_wq' was not > > declared. Should it be static? > > >> kernel/workqueue.c:4434:61: sparse: expression using sizeof bool > >kernel/workqueue.c:2060:32: sparse: context imbalance in > > 'manage_workers' - unexpected unlock > > > > vim +4434 kernel/workqueue.c > > > ... > > 4433 /* copy worker description */ > > > 4434 probe_kernel_read(_valid, >desc_valid, > > > sizeof(desc_valid)); > > 4435 if (desc_valid) > > I don't know what to make of this warning. Yes, it's probing a bool > variable and of course using sizeof(bool) to do that. Why does sparse > complain about this? I guess sparse warns on sizeof(bool) because it is compiler defined. It may be 1, 4, or even 8 depending on the gcc version and platform. Thanks, Fengguang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: kernel/workqueue.c:4434:61: sparse: expression using sizeof bool
CC Christopher and LKML. On Wed, Apr 03, 2013 at 02:57:18PM -0700, Tejun Heo wrote: Hello, Fengguang. Hi Tejun! On Sat, Mar 30, 2013 at 08:29:47PM +0800, kbuild test robot wrote: tree: git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git review-better-dbg head: ea44ca757342b769c176fd6d0b3fb525b22eeda9 commit: c04655aeae70173688bca4c62b35737ab6958e82 workqueue: include workqueue info when printing debug dump of a worker task date: 10 hours ago sparse warnings: (new ones prefixed by ) kernel/workqueue.c:287:8: sparse: symbol 'cpu_worker_pools' was not declared. Should it be static? kernel/workqueue.c:300:25: sparse: symbol 'system_highpri_wq' was not declared. Should it be static? kernel/workqueue.c:4434:61: sparse: expression using sizeof bool kernel/workqueue.c:2060:32: sparse: context imbalance in 'manage_workers' - unexpected unlock vim +4434 kernel/workqueue.c ... 4433 /* copy worker description */ 4434 probe_kernel_read(desc_valid, worker-desc_valid, sizeof(desc_valid)); 4435 if (desc_valid) I don't know what to make of this warning. Yes, it's probing a bool variable and of course using sizeof(bool) to do that. Why does sparse complain about this? I guess sparse warns on sizeof(bool) because it is compiler defined. It may be 1, 4, or even 8 depending on the gcc version and platform. Thanks, Fengguang -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/