Re: [PATCH AUTOSEL 5.15 11/19] usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc

2023-09-09 Thread Sergey Shtylyov
On 9/9/23 3:38 AM, Sasha Levin wrote:

> From: Ma Ke 
> 
> [ Upstream commit ce9daa2efc0872a9a68ea51dc8000df05893ef2e ]
> 
> We should verify the bound of the array to assure that host
> may not manipulate the index to point past endpoint array.
> 
> Signed-off-by: Ma Ke 
> Acked-by: Li Yang 
> Link: https://lore.kernel.org/r/20230628081511.186850-1-make_ruc2...@163.com
> Signed-off-by: Greg Kroah-Hartman 
> Signed-off-by: Sasha Levin 
> ---
>  drivers/usb/gadget/udc/fsl_qe_udc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c 
> b/drivers/usb/gadget/udc/fsl_qe_udc.c
> index 15db7a3868fe4..aff4050f96dd6 100644
> --- a/drivers/usb/gadget/udc/fsl_qe_udc.c
> +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
> @@ -1956,6 +1956,8 @@ static void ch9getstatus(struct qe_udc *udc, u8 
> request_type, u16 value,
>   } else if ((request_type & USB_RECIP_MASK) == USB_RECIP_ENDPOINT) {
>   /* Get endpoint status */
>   int pipe = index & USB_ENDPOINT_NUMBER_MASK;
> + if (pipe >= USB_MAX_ENDPOINTS)
> + goto stall;

   Hm, what's the earliest version of gcc needed to compile this
(*if* statement amongst the variable declarations)?

>   struct qe_ep *target_ep = &udc->eps[pipe];
>   u16 usep;
>  

MBR, Sergey


Re: [PATCH 00/34] biops: add atomig find_bit() operations

2023-11-18 Thread Sergey Shtylyov
On 11/18/23 7:18 PM, Bart Van Assche wrote:
[...]
>> Add helpers around test_and_{set,clear}_bit() that allow to search for
>> clear or set bits and flip them atomically.
> 
> There is a typo in the subject: shouldn't "atomig" be changed
> into "atomic"?

   And "biops" to "bitops"? :-)

> Thanks,
> 
> Bart.

MBR, Sergey


Re: [PATCH 7/9] ata: pata_falcon: Remove #include

2023-08-17 Thread Sergey Shtylyov
On 8/17/23 7:07 PM, Geert Uytterhoeven wrote:

> The Atari Falcon PATA driver does not need anything from .
> 
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Sergey Shtylyov 

[...]

MBR, Sergey


Re: [PATCH 8/9] ata: pata_gayle: Remove #include

2023-08-17 Thread Sergey Shtylyov
On 8/17/23 7:07 PM, Geert Uytterhoeven wrote:

> The Amiga Gayle PATA driver does not need anything from .
> 
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Sergey Shtylyov 

[...]

MBR, Sergey


Re: [PATCH 6/9] ata: pata_buddha: Remove #include

2023-08-17 Thread Sergey Shtylyov
On 8/17/23 7:07 PM, Geert Uytterhoeven wrote:

> The Buddha, Catweasel, and X-Surf PATA driver does not need anything
> from .
> 
> Signed-off-by: Geert Uytterhoeven 

Reviewed-by: Sergey Shtylyov 

[...]

MBR, Sergey


[PATCH 00/13] Make user_regset_copyin_ignore() *void*

2022-10-14 Thread Sergey Shtylyov
Here are 13 patches against the 'next-20221014' tag of the 'linux-next.git'
repo.  I'm not sure how this cross-arch series should be merged -- perhaps
thru Andrew Morton's tree?

user_regset_copyin_ignore() apparently cannot fail and so always returns 0.
Let's first remove the result checks in several architectures that call this
function and then make user_regset_copyin_ignore() return *void* instead of
*int*...

Sergey Shtylyov (13):
  arc: ptrace: user_regset_copyin_ignore() always returns 0
  arm: ptrace: user_regset_copyin_ignore() always returns 0
  arm64: ptrace: user_regset_copyin_ignore() always returns 0
  hexagon: ptrace: user_regset_copyin_ignore() always returns 0
  ia64: ptrace: user_regset_copyin_ignore() always returns 0
  mips: ptrace: user_regset_copyin_ignore() always returns 0
  nios2: ptrace: user_regset_copyin_ignore() always returns 0
  openrisc: ptrace: user_regset_copyin_ignore() always returns 0
  parisc: ptrace: user_regset_copyin_ignore() always returns 0
  powerpc: ptrace: user_regset_copyin_ignore() always returns 0
  sh: ptrace: user_regset_copyin_ignore() always returns 0
  sparc: ptrace: user_regset_copyin_ignore() always returns 0
  regset: make user_regset_copyin_ignore() *void*

 arch/arc/kernel/ptrace.c |  2 +-
 arch/arm/kernel/ptrace.c |  8 +++-
 arch/arm64/kernel/ptrace.c   | 16 
 arch/hexagon/kernel/ptrace.c |  7 +++
 arch/ia64/kernel/ptrace.c| 20 +---
 arch/mips/kernel/ptrace.c|  9 +
 arch/nios2/kernel/ptrace.c   |  6 +++---
 arch/openrisc/kernel/ptrace.c|  8 +++-
 arch/parisc/kernel/ptrace.c  | 15 +--
 arch/powerpc/kernel/ptrace/ptrace-tm.c   | 10 +-
 arch/powerpc/kernel/ptrace/ptrace-view.c | 10 +-
 arch/sh/kernel/ptrace_32.c   |  8 
 arch/sparc/kernel/ptrace_32.c|  9 +
 arch/sparc/kernel/ptrace_64.c| 23 +++
 include/linux/regset.h   | 15 +++
 15 files changed, 77 insertions(+), 89 deletions(-)

-- 
2.26.3



[PATCH 10/13] powerpc: ptrace: user_regset_copyin_ignore() always returns 0

2022-10-14 Thread Sergey Shtylyov
user_regset_copyin_ignore() always returns 0, so checking its result seems
pointless -- don't do this anymore...

Signed-off-by: Sergey Shtylyov 
---
 arch/powerpc/kernel/ptrace/ptrace-tm.c   | 10 +-
 arch/powerpc/kernel/ptrace/ptrace-view.c | 10 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kernel/ptrace/ptrace-tm.c 
b/arch/powerpc/kernel/ptrace/ptrace-tm.c
index 44045363a903..210ea834e603 100644
--- a/arch/powerpc/kernel/ptrace/ptrace-tm.c
+++ b/arch/powerpc/kernel/ptrace/ptrace-tm.c
@@ -170,9 +170,9 @@ int tm_cgpr_set(struct task_struct *target, const struct 
user_regset *regset,
 (PT_MAX_PUT_REG + 1) * sizeof(reg));
 
if (PT_MAX_PUT_REG + 1 < PT_TRAP && !ret)
-   ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-   (PT_MAX_PUT_REG + 1) * 
sizeof(reg),
-   PT_TRAP * sizeof(reg));
+   user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+ (PT_MAX_PUT_REG + 1) * sizeof(reg),
+ PT_TRAP * sizeof(reg));
 
if (!ret && count > 0) {
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®,
@@ -183,8 +183,8 @@ int tm_cgpr_set(struct task_struct *target, const struct 
user_regset *regset,
}
 
if (!ret)
-   ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-   (PT_TRAP + 1) * sizeof(reg), 
-1);
+   user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+ (PT_TRAP + 1) * sizeof(reg), -1);
 
return ret;
 }
diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c 
b/arch/powerpc/kernel/ptrace/ptrace-view.c
index 076d867412c7..ca0bf8da48fd 100644
--- a/arch/powerpc/kernel/ptrace/ptrace-view.c
+++ b/arch/powerpc/kernel/ptrace/ptrace-view.c
@@ -267,9 +267,9 @@ static int gpr_set(struct task_struct *target, const struct 
user_regset *regset,
 (PT_MAX_PUT_REG + 1) * sizeof(reg));
 
if (PT_MAX_PUT_REG + 1 < PT_TRAP && !ret)
-   ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-   (PT_MAX_PUT_REG + 1) * 
sizeof(reg),
-   PT_TRAP * sizeof(reg));
+   user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+ (PT_MAX_PUT_REG + 1) * sizeof(reg),
+ PT_TRAP * sizeof(reg));
 
if (!ret && count > 0) {
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®,
@@ -280,8 +280,8 @@ static int gpr_set(struct task_struct *target, const struct 
user_regset *regset,
}
 
if (!ret)
-   ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-   (PT_TRAP + 1) * sizeof(reg), 
-1);
+   user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+ (PT_TRAP + 1) * sizeof(reg), -1);
 
return ret;
 }
-- 
2.26.3



Re: [PATCH v3 10/24] sparc: Remove COMMAND_LINE_SIZE from uapi

2023-02-14 Thread Sergey Shtylyov
On 2/14/23 10:49 AM, Alexandre Ghiti wrote:

> From: Palmer Dabbelt 
> 
> As far as I can tell this is not used by userspace and thus should not
> be part of the user-visible API.
> 
> Signed-off-by: Palmer Dabbelt 
> ---
>  arch/sparc/include/asm/setup.h  | 6 +-
>  arch/sparc/include/uapi/asm/setup.h | 7 ---
>  2 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h
> index 72205684e51e..d1384ed92547 100644
> --- a/arch/sparc/include/asm/setup.h
> +++ b/arch/sparc/include/asm/setup.h
> @@ -7,7 +7,11 @@
>  
>  #include 
>  
> -#include 
> +#if defined(__sparc__) && defined(__arch64__)

   Mhm, I don't think these two can be #define'd simulaneously...

> +# define COMMAND_LINE_SIZE 2048
> +#else
> +# define COMMAND_LINE_SIZE 256
> +#endif
>  
>  extern char reboot_command[];
>  
> diff --git a/arch/sparc/include/uapi/asm/setup.h 
> b/arch/sparc/include/uapi/asm/setup.h
> index 3c208a4dd464..c3cf1b0d30b3 100644
> --- a/arch/sparc/include/uapi/asm/setup.h
> +++ b/arch/sparc/include/uapi/asm/setup.h
> @@ -6,11 +6,4 @@
>  #ifndef _UAPI_SPARC_SETUP_H
>  #define _UAPI_SPARC_SETUP_H
>  
> -#if defined(__sparc__) && defined(__arch64__)
> -# define COMMAND_LINE_SIZE 2048
> -#else
> -# define COMMAND_LINE_SIZE 256
> -#endif
> -
> -
>  #endif /* _UAPI_SPARC_SETUP_H */

MBR, Sergey


Re: [PATCH v3 10/24] sparc: Remove COMMAND_LINE_SIZE from uapi

2023-02-14 Thread Sergey Shtylyov
On 2/14/23 11:59 AM, WANG Xuerui wrote:
[...]

>>> From: Palmer Dabbelt 
>>>
>>> As far as I can tell this is not used by userspace and thus should not
>>> be part of the user-visible API.
>>>
>>> Signed-off-by: Palmer Dabbelt 
>>> ---
>>>   arch/sparc/include/asm/setup.h  | 6 +-
>>>   arch/sparc/include/uapi/asm/setup.h | 7 ---
>>>   2 files changed, 5 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h
>>> index 72205684e51e..d1384ed92547 100644
>>> --- a/arch/sparc/include/asm/setup.h
>>> +++ b/arch/sparc/include/asm/setup.h
>>> @@ -7,7 +7,11 @@
>>>     #include 
>>>   -#include 
>>> +#if defined(__sparc__) && defined(__arch64__)
>>
>>     Mhm, I don't think these two can be #define'd simulaneously...
> 
> I believe it's just a SPARC-ism [1] [2] that may look strange and be easily 
> confused for __aarch64__ (notice the extra 'a')...

  Yeah, sorry, I did confuse it with AArgh64. :-)

[...]

MNR, Sergey


[PATCH v2 7/9] usb: phy: fsl-usb: add IRQ check

2021-08-09 Thread Sergey Shtylyov
The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
error code. Stop calling request_irq() with the invalid IRQ #s.

Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")
Signed-off-by: Sergey Shtylyov 

---
 drivers/usb/phy/phy-fsl-usb.c |2 ++
 1 file changed, 2 insertions(+)

Index: usb/drivers/usb/phy/phy-fsl-usb.c
===
--- usb.orig/drivers/usb/phy/phy-fsl-usb.c
+++ usb/drivers/usb/phy/phy-fsl-usb.c
@@ -873,6 +873,8 @@ int usb_otg_start(struct platform_device
 
/* request irq */
p_otg->irq = platform_get_irq(pdev, 0);
+   if (p_otg->irq < 0)
+   return p_otg->irq;
status = request_irq(p_otg->irq, fsl_otg_isr,
IRQF_SHARED, driver_name, p_otg);
if (status) {


Re: consolidate the compat fcntl definitions

2022-01-12 Thread Sergey Shtylyov
Hello!

On 1/11/22 11:35 AM, Christoph Hellwig wrote:

> currenty the compat fcnt definitions are duplicate for all compat

   fcntl?

> architectures, and the native fcntl64 definitions aren't even usable
> from userspace due to a bogus CONFIG_64BIT ifdef.  This series tries
> to sort out all that.

[...]

MBR, Sergey