Re: [PATCH] afs: fix no return statement in function returning non-void
Hi David and Reviewers, Add missing return to fix following compilation issue: fs/afs/dir.c: In function ‘afs_dir_set_page_dirty’: fs/afs/dir.c:51:1: error: no return statement in function returning non-void [-Werror=return-type] Fixes: f3ddee8dc4e2 ("afs: Fix directory handling") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- fs/afs/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 17548c1faf02..1795a05b7cb7 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -48,6 +48,7 @@ static void afs_dir_invalidatepage(struct page *page, unsigned int offset, static int afs_dir_set_page_dirty(struct page *page) { BUG(); /* This should never happen. */ + return 0; } const struct file_operations afs_dir_file_operations = { Is there anyone who can take a look? ;-) Thanks!
[PATCH] afs: fix no return statement in function returning non-void
Add missing return to fix following compilation issue: fs/afs/dir.c: In function ‘afs_dir_set_page_dirty’: fs/afs/dir.c:51:1: error: no return statement in function returning non-void [-Werror=return-type] Fixes: f3ddee8dc4e2 ("afs: Fix directory handling") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- fs/afs/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 17548c1faf02..1795a05b7cb7 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -48,6 +48,7 @@ static void afs_dir_invalidatepage(struct page *page, unsigned int offset, static int afs_dir_set_page_dirty(struct page *page) { BUG(); /* This should never happen. */ + return 0; } const struct file_operations afs_dir_file_operations = { -- 2.20.1
Re: [RESEND] usb: dwc3: meson-g12a: disable clk on error handling path in probe
Hi Greg, On Wed, Dec 23, 2020 at 10:13:03AM +0800, Zheng Zengkai wrote: Hi everyone, Friendly ping: Just want to know why this patch was ignored, Right now it is the merge window and we can't do anything with any patches until 5.11-rc1 is out. After that happens, I'll work on catching up on older patches like this. thanks, greg k-h . Thank you very much for your reply and information! Best Regards, Zheng Zengkai
Re: [RESEND] usb: dwc3: meson-g12a: disable clk on error handling path in probe
Hi everyone, Friendly ping: Just want to know why this patch was ignored, Am I missing something? Merry Christmas and Happy New Year! dwc3_meson_g12a_probe() does not invoke clk_bulk_disable_unprepare() on one error handling path. This patch fixes that. Fixes: 347052e3bf1b ("usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai Reviewed-by: Martin Blumenstingl --- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 417e05381b5d..bdf1f98dfad8 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -754,7 +754,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret = priv->drvdata->setup_regmaps(priv, base); if (ret) - return ret; + goto err_disable_clks; if (priv->vbus) { ret = regulator_enable(priv->vbus);
[RESEND] usb: dwc3: meson-g12a: disable clk on error handling path in probe
dwc3_meson_g12a_probe() does not invoke clk_bulk_disable_unprepare() on one error handling path. This patch fixes that. Fixes: 347052e3bf1b ("usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai Reviewed-by: Martin Blumenstingl --- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 417e05381b5d..bdf1f98dfad8 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -754,7 +754,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret = priv->drvdata->setup_regmaps(priv, base); if (ret) - return ret; + goto err_disable_clks; if (priv->vbus) { ret = regulator_enable(priv->vbus); -- 2.20.1
Re: [PATCH -next] fs/ntfs: fix set but not used variable 'log_page_mask'
Hi Anton and Andrew, Hi Andrew, Ah, oops! Thank you and apologies. Quite right the alternative patch was even better. No need to apply this patch after all... Zheng, the log_page_mask variable was removed altogether so your patch no longer makes sense. Best regards, Anton On 10 Dec 2020, at 02:36, Andrew Morton wrote: On Tue, 8 Dec 2020 08:24:02 + Anton Altaparmakov wrote: Can you please apply this? ... --- a/fs/ntfs/logfile.c +++ b/fs/ntfs/logfile.c @@ -507,7 +507,7 @@ bool ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp) * optimize log_page_size and log_page_bits into constants. */ log_page_bits = ntfs_ffs(log_page_size) - 1; - size &= ~(s64)(log_page_size - 1); + size &= ~(s64)(log_page_mask); /* * Ensure the log file is big enough to store at least the two restart * pages and the minimum number of log record pages. https://lore.kernel.org/lkml/1604821092-54631-1-git-send-email-alex@linux.alibaba.com/ addressed this? It's ok, thank you all the same!
Re: [PATCH] usb: dwc3: meson-g12a: disable clk on error handling path in probe
Hi Felipe and Greg, Ping... On Wed, Nov 11, 2020 at 10:48 AM Zheng Zengkai wrote: dwc3_meson_g12a_probe() does not invoke clk_bulk_disable_unprepare() on one error handling path. This patch fixes that. Fixes: 347052e3bf1b ("usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai Reviewed-by: Martin Blumenstingl many thanks for this fix! Best regards Martin . Could you please get round to taking a glance and giving me a reply? ;-) Thank you very much! Best regards Zengkai
Re: [PATCH -next] fs/ntfs: fix set but not used variable 'log_page_mask'
Ping... Fixes gcc '-Wunused-but-set-variable' warning: fs/ntfs/logfile.c: In function ntfs_check_logfile: fs/ntfs/logfile.c:481:21: warning: variable log_page_mask set but not used [-Wunused-but-set-variable] Actually log_page_mask can be used to replace 'log_page_size - 1' as it is set. Signed-off-by: Zheng Zengkai --- fs/ntfs/logfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c index a0c40f1be7ac..c35fcf389369 100644 --- a/fs/ntfs/logfile.c +++ b/fs/ntfs/logfile.c @@ -507,7 +507,7 @@ bool ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp) * optimize log_page_size and log_page_bits into constants. */ log_page_bits = ntfs_ffs(log_page_size) - 1; - size &= ~(s64)(log_page_size - 1); + size &= ~(s64)(log_page_mask); /* * Ensure the log file is big enough to store at least the two restart * pages and the minimum number of log record pages.
Re: [PATCH -next] perf util: Fix memory leak in __parse_regs()
Ping... On Fri, Jul 03, 2020 at 05:33:44PM +0800, Zheng Zengkai wrote: when using perf record option '-I' or '--user-regs=' along with argument '?' to list available register names, memory of variable 'os' allocated by strdup() needs to be released before __parse_regs() returns, otherwise memory leak will occur. Fixes: bcc84ec65ad1 ("perf record: Add ability to name registers to record") Signed-off-by: Zheng Zengkai Acked-by: Jiri Olsa thanks, jirka --- tools/perf/util/parse-regs-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c index e687497b3aac..a4a100425b3a 100644 --- a/tools/perf/util/parse-regs-options.c +++ b/tools/perf/util/parse-regs-options.c @@ -54,7 +54,7 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr) #endif fputc('\n', stderr); /* just printing available regs */ - return -1; + goto error; } #ifdef HAVE_PERF_REGS_SUPPORT for (r = sample_reg_masks; r->name; r++) { -- 2.20.1 .
Re: [PATCH] usb: dwc3: meson-g12a: disable clk on error handling path in probe
Ping... On Wed, Nov 11, 2020 at 10:48 AM Zheng Zengkai wrote: dwc3_meson_g12a_probe() does not invoke clk_bulk_disable_unprepare() on one error handling path. This patch fixes that. Fixes: 347052e3bf1b ("usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai Reviewed-by: Martin Blumenstingl many thanks for this fix! Best regards Martin .
Re: [PATCH] tomoyo: Avoid potential null pointer access
Hello Tetsuo, On 2020/11/26 15:33, Zheng Zengkai wrote: As your say, I found the function tomoyo_assign_namespace( ) in security/tomoyo/domain.c has the similar situation, Can I add __GFP_NOWARN for both and remove the null check for _entry_ in tomoyo_assign_namespace( )? Good catch. Yes, please send as a patch. . I have resent a patch, thanks!
[PATCH] tomoyo: Fix null pointer check
Since tomoyo_memory_ok() will check for null pointer returned by kzalloc() in tomoyo_assign_profile(), tomoyo_assign_namespace(), tomoyo_get_name() and tomoyo_commit_ok(), then emit OOM warnings if needed. And this is the expected behavior as informed by Tetsuo Handa. Let's add __GFP_NOWARN to kzalloc() in those related functions. Besides, to achieve this goal, remove the null check for entry right after kzalloc() in tomoyo_assign_namespace(). Fixes: 57c2590fb7fd ("TOMOYO: Update profile structure") Fixes: bd03a3e4c9a9 ("TOMOYO: Add policy namespace support.") Reported-by: Hulk Robot Suggested-by: Tetsuo Handa Signed-off-by: Zheng Zengkai --- security/tomoyo/common.c | 2 +- security/tomoyo/domain.c | 4 +--- security/tomoyo/memory.c | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 4bee32bfe16d..bc54d3c8c70a 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -498,7 +498,7 @@ static struct tomoyo_profile *tomoyo_assign_profile ptr = ns->profile_ptr[profile]; if (ptr) return ptr; - entry = kzalloc(sizeof(*entry), GFP_NOFS); + entry = kzalloc(sizeof(*entry), GFP_NOFS | __GFP_NOWARN); if (mutex_lock_interruptible(_policy_lock)) goto out; ptr = ns->profile_ptr[profile]; diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index dc4ecc0b2038..c6e5cc5cc7cd 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c @@ -473,9 +473,7 @@ struct tomoyo_policy_namespace *tomoyo_assign_namespace(const char *domainname) return ptr; if (len >= TOMOYO_EXEC_TMPSIZE - 10 || !tomoyo_domain_def(domainname)) return NULL; - entry = kzalloc(sizeof(*entry) + len + 1, GFP_NOFS); - if (!entry) - return NULL; + entry = kzalloc(sizeof(*entry) + len + 1, GFP_NOFS | __GFP_NOWARN); if (mutex_lock_interruptible(_policy_lock)) goto out; ptr = tomoyo_find_namespace(domainname, len); diff --git a/security/tomoyo/memory.c b/security/tomoyo/memory.c index 2e7fcfa923c9..1b570bde7a3b 100644 --- a/security/tomoyo/memory.c +++ b/security/tomoyo/memory.c @@ -73,7 +73,7 @@ bool tomoyo_memory_ok(void *ptr) */ void *tomoyo_commit_ok(void *data, const unsigned int size) { - void *ptr = kzalloc(size, GFP_NOFS); + void *ptr = kzalloc(size, GFP_NOFS | __GFP_NOWARN); if (tomoyo_memory_ok(ptr)) { memmove(ptr, data, size); @@ -170,7 +170,7 @@ const struct tomoyo_path_info *tomoyo_get_name(const char *name) atomic_inc(>head.users); goto out; } - ptr = kzalloc(sizeof(*ptr) + len, GFP_NOFS); + ptr = kzalloc(sizeof(*ptr) + len, GFP_NOFS | __GFP_NOWARN); if (tomoyo_memory_ok(ptr)) { ptr->entry.name = ((char *) ptr) + sizeof(*ptr); memmove((char *) ptr->entry.name, name, len); -- 2.20.1
Re: [PATCH] tomoyo: Avoid potential null pointer access
Hello, Tetsuo Got it , Thank you for your explanation. Hello, Zheng. Thank you for a patch, but I won't apply this patch. Expected behavior is that tomoyo_warn_oom() is called if tomoyo_memory_ok() is called with entry == NULL. Adding __GFP_NOWARN might be OK, but returning without tomoyo_warn_oom() is NG. On 2020/11/25 21:10, Zheng Zengkai wrote: Calls to kzalloc() should be null-checked in order to avoid any potential failures or unnecessary code execution. Fix this by adding null checks for _entry_ right after allocation. Fixes: 57c2590fb7fd ("TOMOYO: Update profile structure") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai Nacked-by: Tetsuo Handa As your say, I found the function tomoyo_assign_namespace( ) in security/tomoyo/domain.c has the similar situation, Can I add __GFP_NOWARN for both and remove the null check for _entry_ in tomoyo_assign_namespace( )? diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 4bee32bfe16d..bc54d3c8c70a 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -498,7 +498,7 @@ static struct tomoyo_profile *tomoyo_assign_profile ptr = ns->profile_ptr[profile]; if (ptr) return ptr; - entry = kzalloc(sizeof(*entry), GFP_NOFS); + entry = kzalloc(sizeof(*entry), GFP_NOFS | __GFP_NOWARN); if (mutex_lock_interruptible(_policy_lock)) goto out; ptr = ns->profile_ptr[profile]; diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index dc4ecc0b2038..c6e5cc5cc7cd 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c @@ -473,9 +473,7 @@ struct tomoyo_policy_namespace *tomoyo_assign_namespace(const char *domainname) return ptr; if (len >= TOMOYO_EXEC_TMPSIZE - 10 || !tomoyo_domain_def(domainname)) return NULL; - entry = kzalloc(sizeof(*entry) + len + 1, GFP_NOFS); - if (!entry) - return NULL; + entry = kzalloc(sizeof(*entry) + len + 1, GFP_NOFS | __GFP_NOWARN); if (mutex_lock_interruptible(_policy_lock)) goto out; ptr = tomoyo_find_namespace(domainname, len); --- security/tomoyo/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 4bee32bfe16d..99b4fafcb100 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -499,6 +499,8 @@ static struct tomoyo_profile *tomoyo_assign_profile if (ptr) return ptr; entry = kzalloc(sizeof(*entry), GFP_NOFS); + if (!entry) + return NULL; if (mutex_lock_interruptible(_policy_lock)) goto out; ptr = ns->profile_ptr[profile]; .
[PATCH] tomoyo: Avoid potential null pointer access
Calls to kzalloc() should be null-checked in order to avoid any potential failures or unnecessary code execution. Fix this by adding null checks for _entry_ right after allocation. Fixes: 57c2590fb7fd ("TOMOYO: Update profile structure") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- security/tomoyo/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 4bee32bfe16d..99b4fafcb100 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -499,6 +499,8 @@ static struct tomoyo_profile *tomoyo_assign_profile if (ptr) return ptr; entry = kzalloc(sizeof(*entry), GFP_NOFS); + if (!entry) + return NULL; if (mutex_lock_interruptible(_policy_lock)) goto out; ptr = ns->profile_ptr[profile]; -- 2.20.1
[PATCH] serial: ar933x_uart: disable clk on error handling path in probe
ar933x_uart_probe() does not invoke clk_disable_unprepare() on one error handling path. This patch fixes that. Fixes: 9be1064fe524 ("serial: ar933x_uart: add RS485 support") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- drivers/tty/serial/ar933x_uart.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index 0c80a79d7442..c2be7cf91399 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c @@ -789,8 +789,10 @@ static int ar933x_uart_probe(struct platform_device *pdev) goto err_disable_clk; up->gpios = mctrl_gpio_init(port, 0); - if (IS_ERR(up->gpios) && PTR_ERR(up->gpios) != -ENOSYS) - return PTR_ERR(up->gpios); + if (IS_ERR(up->gpios) && PTR_ERR(up->gpios) != -ENOSYS) { + ret = PTR_ERR(up->gpios); + goto err_disable_clk; + } up->rts_gpiod = mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS); -- 2.20.1
[PATCH] usb: dwc3: meson-g12a: disable clk on error handling path in probe
dwc3_meson_g12a_probe() does not invoke clk_bulk_disable_unprepare() on one error handling path. This patch fixes that. Fixes: 347052e3bf1b ("usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 417e05381b5d..bdf1f98dfad8 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -754,7 +754,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret = priv->drvdata->setup_regmaps(priv, base); if (ret) - return ret; + goto err_disable_clks; if (priv->vbus) { ret = regulator_enable(priv->vbus); -- 2.20.1
[PATCH -next] perf util: Fix memory leak in __parse_regs()
when using perf record option '-I' or '--user-regs=' along with argument '?' to list available register names, memory of variable 'os' allocated by strdup() needs to be released before __parse_regs() returns, otherwise memory leak will occur. Fixes: bcc84ec65ad1 ("perf record: Add ability to name registers to record") Signed-off-by: Zheng Zengkai --- tools/perf/util/parse-regs-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c index e687497b3aac..a4a100425b3a 100644 --- a/tools/perf/util/parse-regs-options.c +++ b/tools/perf/util/parse-regs-options.c @@ -54,7 +54,7 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr) #endif fputc('\n', stderr); /* just printing available regs */ - return -1; + goto error; } #ifdef HAVE_PERF_REGS_SUPPORT for (r = sample_reg_masks; r->name; r++) { -- 2.20.1
[PATCH net-next] net: phy: Make iproc_mdio_resume static
Fix sparse warnings: drivers/net/phy/mdio-bcm-iproc.c:182:5: warning: symbol 'iproc_mdio_resume' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- drivers/net/phy/mdio-bcm-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c index f1ded03f0229..89bdfcc0e506 100644 --- a/drivers/net/phy/mdio-bcm-iproc.c +++ b/drivers/net/phy/mdio-bcm-iproc.c @@ -179,7 +179,7 @@ static int iproc_mdio_remove(struct platform_device *pdev) } #ifdef CONFIG_PM_SLEEP -int iproc_mdio_resume(struct device *dev) +static int iproc_mdio_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct iproc_mdio_priv *priv = platform_get_drvdata(pdev); -- 2.20.1
[PATCH -next] ACPI: debug: Make two functions static
Fix sparse warnings: drivers/acpi/acpi_dbg.c:748:12: warning: symbol 'acpi_aml_init' was not declared. Should it be static? drivers/acpi/acpi_dbg.c:774:13: warning: symbol 'acpi_aml_exit' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai --- drivers/acpi/acpi_dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_dbg.c b/drivers/acpi/acpi_dbg.c index 7a265c2171c0..6041974c7627 100644 --- a/drivers/acpi/acpi_dbg.c +++ b/drivers/acpi/acpi_dbg.c @@ -745,7 +745,7 @@ static const struct acpi_debugger_ops acpi_aml_debugger = { .notify_command_complete = acpi_aml_notify_command_complete, }; -int __init acpi_aml_init(void) +static int __init acpi_aml_init(void) { int ret; @@ -771,7 +771,7 @@ int __init acpi_aml_init(void) return 0; } -void __exit acpi_aml_exit(void) +static void __exit acpi_aml_exit(void) { if (acpi_aml_initialized) { acpi_unregister_debugger(_aml_debugger); -- 2.20.1