Re: [PATCH v2 00/11] getting back -Wmaybe-uninitialized
On Sat, Nov 12, 2016 at 01:27:12PM +, Jonathan Cameron wrote: > On 11/11/16 19:49, Arnd Bergmann wrote: > > On Friday, November 11, 2016 9:13:00 AM CET Linus Torvalds wrote: > >> On Thu, Nov 10, 2016 at 8:44 AM, Arnd Bergmann wrote: > >>> > >>> Please merge these directly if you are happy with the result. > >> > >> I will take this. > > > > Thanks a lot! > > > >> I do see two warnings, but they both seem to be valid and recent, > >> though, so I have no issues with the spurious cases. > > > > Ok, both of them should have my fixes coming your way already. > > > >> Warning #1: > >> > >> sound/soc/qcom/lpass-platform.c: In function > >> ‘lpass_platform_pcmops_open’: > >> sound/soc/qcom/lpass-platform.c:83:29: warning: ‘dma_ch’ may be used > >> uninitialized in this function [-Wmaybe-uninitialized] > >> drvdata->substream[dma_ch] = substream; > >> ~~~^~~ > >> > >> and 'dma_ch' usage there really is crazy and wrong. Broken by > >> 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage") > > > > Right, the patches crossed here, the bugfix patch that introduced > > this came into linux-next over the kernel summit, and the fix I > > sent on Tuesday made it into Mark Brown's tree on Wednesday but not > > before you pulled alsa tree. It should be fixed the next time you > > pull from the alsa tree, the commit is > > > > 3b89e4b77ef9 ("ASoC: lpass-platform: initialize dma channel number") > > > >> Warning #2 is not a real bug, but it's reasonable that gcc doesn't > >> know that storage_bytes (chip->read_size) has to be 2/4. Again, > >> introduced recently by commit 231147ee77f3 ("iio: maxim_thermocouple: > >> Align 16 bit big endian value of raw reads"), so you didn't see it. > > > > This is the one I mentioned in the commit message as one that > > is fixed in linux-next and that should make it in soon. > > > >> drivers/iio/temperature/maxim_thermocouple.c: In function > >> ‘maxim_thermocouple_read_raw’: > >> drivers/iio/temperature/maxim_thermocouple.c:141:5: warning: ‘ret’ > >> may be used uninitialized in this function [-Wmaybe-uninitialized] > >> if (ret) > >>^ > >> drivers/iio/temperature/maxim_thermocouple.c:128:6: note: ‘ret’ was > >> declared here > >> int ret; > >> ^~~ > >> > >> and I guess that code can just initialize 'ret' to '-EINVAL' or > >> something to just make the theoretical "somehow we had a wrong > >> chip->read_size" case error out cleanly. > > > > Right, that was my conclusion too. I sent the bugfix on Oct 25 > > for linux-next but it didn't make it in until this Monday, after > > you pulled the patch that introduced it on Oct 29. > > > > The commit in staging-testing is > > 32cb7d27e65d ("iio: maxim_thermocouple: detect invalid storage size in > > read()") > > > > Greg and Jonathan, I see now that this is part of the 'iio-for-4.10b' > > branch, so I suspect you were not planning to send this before the > > merge window. Could you make sure this ends up in v4.9 so we get > > a clean build when -Wmaybe-uninitialized gets enabled again? > I'll queue this up and send a pull to Greg tomorrow. > > Was highly doubtful that a false warning suppression (be it an > understandable one) was worth sending mid cycle, hence it was > taking the slow route. I can just cherry-pick this, no need to send a separate pull request. greg k-h ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v2 00/11] getting back -Wmaybe-uninitialized
On Sun, Nov 13, 2016 at 09:47:41AM +0100, Greg KH wrote: > On Sat, Nov 12, 2016 at 01:27:12PM +, Jonathan Cameron wrote: > > On 11/11/16 19:49, Arnd Bergmann wrote: > > > On Friday, November 11, 2016 9:13:00 AM CET Linus Torvalds wrote: > > >> On Thu, Nov 10, 2016 at 8:44 AM, Arnd Bergmann wrote: > > >>> > > >>> Please merge these directly if you are happy with the result. > > >> > > >> I will take this. > > > > > > Thanks a lot! > > > > > >> I do see two warnings, but they both seem to be valid and recent, > > >> though, so I have no issues with the spurious cases. > > > > > > Ok, both of them should have my fixes coming your way already. > > > > > >> Warning #1: > > >> > > >> sound/soc/qcom/lpass-platform.c: In function > > >> ‘lpass_platform_pcmops_open’: > > >> sound/soc/qcom/lpass-platform.c:83:29: warning: ‘dma_ch’ may be used > > >> uninitialized in this function [-Wmaybe-uninitialized] > > >> drvdata->substream[dma_ch] = substream; > > >> ~~~^~~ > > >> > > >> and 'dma_ch' usage there really is crazy and wrong. Broken by > > >> 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage") > > > > > > Right, the patches crossed here, the bugfix patch that introduced > > > this came into linux-next over the kernel summit, and the fix I > > > sent on Tuesday made it into Mark Brown's tree on Wednesday but not > > > before you pulled alsa tree. It should be fixed the next time you > > > pull from the alsa tree, the commit is > > > > > > 3b89e4b77ef9 ("ASoC: lpass-platform: initialize dma channel number") > > > > > >> Warning #2 is not a real bug, but it's reasonable that gcc doesn't > > >> know that storage_bytes (chip->read_size) has to be 2/4. Again, > > >> introduced recently by commit 231147ee77f3 ("iio: maxim_thermocouple: > > >> Align 16 bit big endian value of raw reads"), so you didn't see it. > > > > > > This is the one I mentioned in the commit message as one that > > > is fixed in linux-next and that should make it in soon. > > > > > >> drivers/iio/temperature/maxim_thermocouple.c: In function > > >> ‘maxim_thermocouple_read_raw’: > > >> drivers/iio/temperature/maxim_thermocouple.c:141:5: warning: ‘ret’ > > >> may be used uninitialized in this function [-Wmaybe-uninitialized] > > >> if (ret) > > >>^ > > >> drivers/iio/temperature/maxim_thermocouple.c:128:6: note: ‘ret’ was > > >> declared here > > >> int ret; > > >> ^~~ > > >> > > >> and I guess that code can just initialize 'ret' to '-EINVAL' or > > >> something to just make the theoretical "somehow we had a wrong > > >> chip->read_size" case error out cleanly. > > > > > > Right, that was my conclusion too. I sent the bugfix on Oct 25 > > > for linux-next but it didn't make it in until this Monday, after > > > you pulled the patch that introduced it on Oct 29. > > > > > > The commit in staging-testing is > > > 32cb7d27e65d ("iio: maxim_thermocouple: detect invalid storage size in > > > read()") > > > > > > Greg and Jonathan, I see now that this is part of the 'iio-for-4.10b' > > > branch, so I suspect you were not planning to send this before the > > > merge window. Could you make sure this ends up in v4.9 so we get > > > a clean build when -Wmaybe-uninitialized gets enabled again? > > I'll queue this up and send a pull to Greg tomorrow. > > > > Was highly doubtful that a false warning suppression (be it an > > understandable one) was worth sending mid cycle, hence it was > > taking the slow route. > > I can just cherry-pick this, no need to send a separate pull request. Now done and sent to Linus, so all should be good here. thanks, greg k-h ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH 3.16 278/346] ARC: uaccess: get_user to zero out dest in cause of fault
3.16.39-rc1 review patch. If anyone has any objections, please let me know. -- From: Vineet Gupta commit 05d9d0b96e53c52a113fd783c0c97c830c8dc7af upstream. Al reported potential issue with ARC get_user() as it wasn't clearing out destination pointer in case of fault due to bad address etc. Verified using following | { | u32 bogus1 = 0xdeadbeef; | u64 bogus2 = 0xdead; | int rc1, rc2; | | pr_info("Orig values %x %llx\n", bogus1, bogus2); | rc1 = get_user(bogus1, (u32 __user *)0x4000); | rc2 = get_user(bogus2, (u64 __user *)0x5000); | pr_info("access %d %d, new values %x %llx\n", | rc1, rc2, bogus1, bogus2); | } | [ARCLinux]# insmod /mnt/kernel-module/qtn.ko | Orig values deadbeef dead | access -14 -14, new values 0 0 Reported-by: Al Viro Cc: Linus Torvalds Cc: linux-snps-arc@lists.infradead.org Cc: linux-ker...@vger.kernel.org Signed-off-by: Vineet Gupta Signed-off-by: Al Viro Signed-off-by: Ben Hutchings --- arch/arc/include/asm/uaccess.h | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h @@ -83,7 +83,10 @@ "2: ;nop\n" \ " .section .fixup, \"ax\"\n" \ " .align 4\n" \ - "3: mov %0, %3\n" \ + "3: # return -EFAULT\n" \ + " mov %0, %3\n" \ + " # zero out dst ptr\n" \ + " mov %1, 0\n" \ " j 2b\n" \ " .previous\n"\ " .section __ex_table, \"a\"\n" \ @@ -101,7 +104,11 @@ "2: ;nop\n" \ " .section .fixup, \"ax\"\n" \ " .align 4\n" \ - "3: mov %0, %3\n" \ + "3: # return -EFAULT\n" \ + " mov %0, %3\n" \ + " # zero out dst ptr\n" \ + " mov %1, 0\n" \ + " mov %R1, 0\n" \ " j 2b\n" \ " .previous\n"\ " .section __ex_table, \"a\"\n" \ ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc