Re: [PATCH cifs segfault ]

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

 



Seth Thielemann <sthielemann@xxxxxxxxxxxxx> writes:
>   This definitely could be a bug with the compiler, I ran into issues adding some printk's and things just magically worked and then changed to adding asm volatile nop sentinel's to make sure I was looking at the correct sections. I still think it's a reasonable change to use the ssize_t since the rc is a ssize_t and the outbound syscall path is also a ssize_t. Best case scenario is a segfault in userspace (made things easier to track down), but will likely wind up with memory corruption otherwise.

Looking at this more I found that commit 97adda8b3ab7 fixed a very
similar issue:

-       ctx->rc = (rc == 0) ? ctx->total_len : rc;
+       ctx->rc = (rc == 0) ? (ssize_t)ctx->total_len : rc;

I think the logic is that compiler sees the "then" part as unsigned and
so casts the "else" part to unsigned as well.

In any case I think the change is good. We could change rc type in the
read path as well.

Reviewed-by: Aurelien Aptel <aaptel@xxxxxxxx>

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux