Re: [PATCH] fs: btrfs: fix out of bounds write

2024-06-18 Thread Dan Carpenter
ly > read files into huge static memory areas. > > Signed-off-by: Alex Shumsky Could you add a Fixes tag? regards, dan carpenter

Re: [PATCH] efi_loader: capsule: detect possible ESP device path

2024-05-08 Thread Dan Carpenter
if (full_path) { > + boot_dev = full_path; Later, we free full_path but do we ever free the original boot_dev? > + goto found; > + } else { > + efi_free_pool(boot_dev); > + boot_dev = NULL; > + } Better to delete indenting where you can: full_path = get_esp_from_boot_option_file_path(boot_dev); if (full_path) { boot_dev = full_path; goto found; } efi_free_pool(boot_dev); boot_dev = NULL; regards, dan carpenter

Re: [PATCH] board: amlogic: fix buffler overflow in serial & usid read

2024-03-19 Thread Dan Carpenter
it in either hsearch_r() or env_get_from_linear(). All the other functions had a mac_addr[] issue as well. Btw, this kind of bug is a good candidate for a static checker warning. I can create a Smatch check for this. It would probably be easier in Coccinelle even, but I'm the Smatch maint

Re: [PATCH] fs: ext4: Fixed file permissions

2024-03-14 Thread Dan Carpenter
ory leaks would need to be fixed. For the style issues run ./scripts/checkpatch.pl on your patch. regards, dan carpenter

Re: [PATCH 01/19] spi: cadence_qspi: Add support for DDR PHY mode

2024-03-13 Thread Dan Carpenter
const struct spi_mem_op *op) > { > @@ -353,6 +649,9 @@ static int cadence_spi_mem_exec_op(struct spi_slave *spi, > break; > } > > + if (op->cmd.dtr) > + err = cadence_spi_setup_ddrmode(spi, op); > + > return err; I think there should be another if (err) return err after the end of the switch statement. > } > regards, dan carpenter

Re: [PATCH] fdt_support: fix fdt_copy_fixed_partitions function()

2024-03-11 Thread Dan Carpenter
f people abandon this style guideline. regards, dan carpenter > Fixes: 163c5f60ebb4 ("fdt_support: add fdt_copy_fixed_partitions function") > > Signed-off-by: Patrice Chotard > ---

Re: [PATCH 1/2] sandbox: select CONFIG_64BIT for SANDBOX64

2024-03-11 Thread Dan Carpenter
On Wed, Mar 06, 2024 at 09:50:06AM +0100, Heinrich Schuchardt wrote: > On 3/5/24 16:16, Dan Carpenter wrote: > > Select CONFIG_64BIT so that we pass the -m64 option (instead of -m32) to > > static analysis tools. > > > > Signed-off-by: Dan Carpenter > > -

Re: [PATCH v2 5/5] power: regulator: tps65941: Add TPS65224 PMIC regulator support

2024-03-09 Thread Dan Carpenter
bears' food... This is invalid. This is low. This is high. This poridge is just right. regards, dan carpenter

Re: [PATCH] cmd: sbi: Correctly display unknown implementation IDs

2024-03-07 Thread Dan Carpenter
ot the implementation ID. > > * Show the correct number > * Use a hexadecimal output format > * Add a missing line feed > > Signed-off-by: Heinrich Schuchardt Reviewed-by: Dan Carpenter Fixes: 89a86dcf6191 ("cmd: sbi: show SBI implementation version") regards, dan carpenter

Re: [PATCH v3] board: rockchip: add Rockchip Toybrick TB-RK3588X board

2024-03-05 Thread Dan Carpenter
.end = 0x3fc4f, > + }; > + struct fdt_memory gap2 = { > + .start = 0x3fff0, > + .end = 0x3, > + }; > + unsigned long flags = FDTDEC_RESERVED_MEMORY_NO_MAP; > + unsigned int ret; "ret" should be int. This doesn't affect runtim

[PATCH 2/2] sandbox: select CONFIG_64BIT for X86_64

2024-03-05 Thread Dan Carpenter
Select CONFIG_64BIT so that we pass the -m64 option (instead of -m32) to static analysis tools. Signed-off-by: Dan Carpenter --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 99e59d94c606..fb7772936cd5 100644 --- a/arch/x86

[PATCH 1/2] sandbox: select CONFIG_64BIT for SANDBOX64

2024-03-05 Thread Dan Carpenter
Select CONFIG_64BIT so that we pass the -m64 option (instead of -m32) to static analysis tools. Signed-off-by: Dan Carpenter --- arch/sandbox/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 0ce77de2fcb4..c431da60e8c4 100644

[PATCH 0/2] Select CONFIG_64BIT for sandbox64 and x86_64

2024-03-05 Thread Dan Carpenter
the correct machine size 1053 CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) Dan Carpenter (2): sandbox: select CONFIG_64BIT for SANDBOX64 sandbox: select CONFIG_64BIT for X86_64 arch/sandbox/Kconfig | 1 + arch/x86/Kconfig | 1 + 2 files changed, 2 insertions(+) -- 2.43.0

Re: [PATCH v2] initcall: break loop immediately on failure

2024-03-05 Thread Dan Carpenter
n v2: > - Don't drop the initialisation of ret (thanks Dan!). > - Link to v1: > https://lore.kernel.org/u-boot/20240219183519.2183405-1-caleb.conno...@linaro.org/ > > Cc: Dan Carpenter Awesome. Thanks! Reviewed-by: Dan Carpenter regards, dan carpenter

Re: [PATCH v2 2/2] arm64: Enable CONFIG_64BIT for static analysis

2024-03-04 Thread Dan Carpenter
On Mon, Mar 04, 2024 at 02:44:12PM +0100, Heinrich Schuchardt wrote: > On 04.03.24 08:04, Dan Carpenter wrote: > > In the Makefile there is a line that says this: > > > > # the checker needs the correct machine size > > CHECKFLAGS += $(if $(CONFIG_64B

Re: RE: [PATCH] net: phy: ncsi: Correct the endian of the checksum

2024-03-04 Thread Dan Carpenter
Anyway, looks good! I already gave my reviewed by. Thanks for your work on this. regards, dan carpenter

[PATCH v2 2/2] arm64: Enable CONFIG_64BIT for static analysis

2024-03-03 Thread Dan Carpenter
In the Makefile there is a line that says this: # the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) Set CONFIG_64BIT for ARM64 so that we pass -m64 to the static checkers instead of -m32. Signed-off-by: Dan Carpenter --- v2: split the patch

[PATCH v2 1/2] Kconfig: move CONFIG_32/64BIT to arch/Kconfig

2024-03-03 Thread Dan Carpenter
These configs are used in multiple places so put them in a shared Kconfig file. Signed-off-by: Dan Carpenter --- v2: split the patch into two patches arch/Kconfig | 6 ++ arch/mips/Kconfig | 6 -- arch/riscv/Kconfig | 6 -- 3 files changed, 6 insertions(+), 12 deletions

[PATCH v2 0/2] arm64: Enable CONFIG_64BIT for static analysis

2024-03-03 Thread Dan Carpenter
The makefiles currently pass -m32 to Smatch static checker when I'm building on arm64. Also the arch is set to "arm" and Smatch thinks "arm" is 32 bits and "arm64" is 64 bits. With this patchset we pass -m64 and Smatch works correctly. Changes since v1: Break up th

Re: 回覆: [PATCH] net: phy: ncsi: Correct the endian of the checksum

2024-03-03 Thread Dan Carpenter
On Sun, Mar 03, 2024 at 02:14:43AM +, Jacky Chou wrote: > Hi Dan Carpenter, > > I have verified it on the little-endian platform, such as ASPEED AST2600. Awesome. Thanks for this. > I think put_unaligned_be32() and htonl() functions have no effect on > big-endian platfo

Re: [PATCH] mtd: nand: arasan: Update the correct return codes

2024-03-01 Thread Dan Carpenter
use a crash... Fixes: 3dd0f8cccd6d ("mtd: nand: Remove hardcoded base address of nand") regards, dan carpenter

Re: [UBOOT PATCH v3] mtd: nand: arasan: Print warning for unsupported ecc modes

2024-03-01 Thread Dan Carpenter
so probably we should add a NULL check here too. if (!str || strcmp(str, "hw") != 0) { regards, dan carpenter

Re: [PATCH 4/8] clk: qcom: add support for power domains uclass

2024-02-29 Thread Dan Carpenter
goto unbind_rstdev; return 0; unbind_rstdev: device_unbind(rstdev); unbind_clkdev: device_unbind(clkdev); return ret; > + > return ret; > } > regards, dan carpenter

Re: ECDSA related PRs

2024-02-28 Thread Dan Carpenter
ught in with greater ease. Yeah. For this kind of thing you wouldn't want to make a bunch of checkpatch changes. They sometimes pull crypto and compression libraries into the Linux kernel pretty much unmodified as well for the same reason. Igor's proposal about pull this stuff from the Linux ke

Re: [PATCH 1/2] opos6uldev: make the LCD work again

2024-02-27 Thread Dan Carpenter
") > Signed-off-by: Sébastien Szymanski Huh. This is the commit that did that upstream. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d9aa4d4fca67823838fe9861456201430c545e69 It's interesting how the timings in linux were always slightly different from in u-boot. regards, dan carpenter

Re: [PATCH 05/10] mach-snapdragon: Update gd->ram_size in msm_fixup_memory

2024-02-26 Thread Dan Carpenter
bank_size, count); > > - return 0; > + return ret; Please leave this as return 0; regards, dan carpenter

Re: [PATCH RESEND] serial: pl01x: set baudrate when probing

2024-02-26 Thread Dan Carpenter
This if statement seems to be reversed. regards, dan carpenter > + return ret; > + return pl01x_serial_setbrg(dev, gd->baudrate); > + } else { > return 0; > + } > }

Re: [PATCH v1 5/5] power: regulator: tps65941: Add TPS65224 PMIC regulator support

2024-02-23 Thread Dan Carpenter
;if (value > reg_base)". Or something like this: val = val >> 1; if (val < 0 || val > mask) return -EINVAL; if (val <= reg_base) return base; if (val >= reg_max) return max; return base + (step * (val - reg_base)); regards, dan carpenter

Re: [PATCH] ARM: Enable CONFIG_64BIT for static analysis

2024-02-22 Thread Dan Carpenter
; 64BIT entries to arch/Kconfig and then select it for ARM64? Thanks. Sure. Even better. regards, dan carpenter

[PATCH] ARM: Enable CONFIG_64BIT for static analysis

2024-02-21 Thread Dan Carpenter
In the Makefile there is a line that says this: # the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) So set CONFIG_64BIT so that we don't pass -m32 to the static checker. Signed-off-by: Dan Carpenter --- arch/arm/Kconfig | 4 1 file changed

[PATCH] bootstd: fix build error when CONFIG_MMC is disabled

2024-02-20 Thread Dan Carpenter
to `_u_boot_list_2_bootdev_hunter_2_mmc_bootdev_hunter' Fixes: 66e3dce78750 ("bootstd: Allow hunting for a bootdev by label") Signed-off-by: Dan Carpenter --- test/boot/bootstd_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_comm

[PATCH] bootflow: Fix build error when BOOTMETH_CROS is disabled

2024-02-20 Thread Dan Carpenter
to `_u_boot_list_2_driver_2_bootmeth_cros' Fixes: d08db02d2d3d ("bootstd: Add a test for bootmeth_cros") Signed-off-by: Dan Carpenter --- test/boot/bootflow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index fa54dde661c8..4845b7121c84 100644

Re: [PATCH] implement policy_pcr commands to lock NV-indexes behind a PCR

2024-02-20 Thread Dan Carpenter
h level review but I kept getting distracted and lost and I couldn't apply the patch so it was just really hard to figure out what was going on. :( regards, dan carpenter

Re: [PATCH] initcall: break loop immediately on failure

2024-02-20 Thread Dan Carpenter
is called from board_init_f_r(). The array is empty except for the NULL sentinal at the end. We don't enter the loop in that case. regards, dan carpenter > > - for (ptr = init_sequence; func = *ptr, !ret && func; ptr++) { > + for (ptr = init_

Re: [PATCH] video: simplefb: modernise DT parsing

2024-02-20 Thread Dan Carpenter
ret); > + return ret; This should be something like: return ret ?: -EINVAL; Perhaps print the width and height in the error message as well. regards, dan carpenter

Re: [PATCH v2] dma: ti: k3-udma: Fix error handling for setup_resources() in udma_probe()

2024-02-20 Thread Dan Carpenter
t" at the end of udma_probe() to a > "return 0", to explicitly indicate that probe was successful. > > Fixes: a8837cf43839 ("dma: ti: k3-udma: Query DMA channels allocated from > Resource Manager") > Signed-off-by: Siddharth Vadapalli > --- Thanks! Reviewed-by: Dan Carpenter regards, dan carpenter

Re: [PATCH] dma: ti: k3-udma: Fix error handling for setup_resources() in udma_probe()

2024-02-20 Thread Dan Carpenter
(ret <= 0) > + return ret; The code was like this originally, but setup_resources() can't actually return zero so it would be nicer to say: ret = setup_resources(ud); if (ret < 0) return ret; regards, dan carpenter > + > + ud->ch_count = ret; >

Re: [PATCH v3 2/3] board: Add support for Sielaff i.MX6 Solo board

2024-02-20 Thread Dan Carpenter
On Tue, Feb 20, 2024 at 09:38:01AM +0100, Frieder Schrempf wrote: > Hi Dan, > > On 20.02.24 06:56, Dan Carpenter wrote: > > On Thu, Feb 15, 2024 at 02:35:20PM +0100, Frieder Schrempf wrote: > >> +int board_mmc_getcd(struct mmc *mmc) > > > > This function is ne

Re: [PATCH v4 03/39] mmc: msm_sdhci: use modern clock handling

2024-02-19 Thread Dan Carpenter
et; > + /* If clock-names is unspecified, then the first clock is the core > clock */ > + if (!ofnode_get_property(node, "clock-names", _clks)) { > + if (!clk_set_rate(>clks.clks[0], clk_rate)) { > + log_

Re: [PATCH v3 2/3] board: Add support for Sielaff i.MX6 Solo board

2024-02-19 Thread Dan Carpenter
(%d) than supported by the board\n" There is a checkpatch warnings for this. WARNING: Avoid line continuations in quoted strings #1137: FILE: board/sielaff/imx6dl-sielaff/spl.c:96: + printf("Warning: you configured more USDHC controllers \ regards, dan carpenter

Re: [PATCH] command: add FDT setup for bootelf by flag

2024-02-12 Thread Dan Carpenter
x ...\n", fdt_addr); if (image_setup_libfdt(, (void *)fdt_addr, 0, NULL)) { printf("ERROR: Failed to process device tree\n"); return 1; } } regards, dan carpenter

Re: [PATCH v2 1/7] common: avb_verify: don't call mmc_switch_part for SD

2024-02-11 Thread Dan Carpenter
he visible effects for the user? regards, dan carpenter

Re: [PATCH] xyzModem: Correct xmodem blk verification conditions

2024-02-06 Thread Dan Carpenter
type unsigned char. If you take the ~ of an unsigned char it's going to be 0xffXX where XX are the a variable bits. That's never going to be equal to xyz.cblk. You could truncate it to char like this: + if ((unsigned char)~xyz.blk != xyz.cblk) But then it works exactly the same as the original condition. regards, dan carpenter

Re: [PATCH v2 1/4] imx8mp-phyboard-pollux-rdk: sync with kernel devicetree from v6.8-rc2

2024-02-06 Thread Dan Carpenter
oard-pollux: Add missing usdhc clocks assignment 055e38c76388 arm64: dts: imx8mp-phyboard-pollux-rdk: Fix led sub-node names regards, dan carpenter

Re: [PATCH] net: phy: ncsi: Correct the endian of the checksum

2024-02-05 Thread Dan Carpenter
On Mon, Feb 05, 2024 at 04:02:28PM +0800, Jacky Chou wrote: > There is no need to perform the endian twice here. > > Signed-off-by: Jacky Chou Reviewed-by: Dan Carpenter Fixes: f641a8ac93e0 ("phy: Add support for the NC-SI protocol") How did this ever work? Was this a

Re: [PATCH] xyzModem: Correct xmodem blk verification conditions

2024-02-05 Thread Dan Carpenter
. Is that really intentional? Is this from reviewing documentation or something? What documents? Or is it from testing? regards, dan carpenter

Re: [PATCH] net: macb: Add support for fixed link

2024-02-04 Thread Dan Carpenter
"); > + if (fl_node != -FDT_ERR_NOTFOUND) { Why not check for if (fl_node >= 0)? The fdt_subnode_offset() function can return a variety of error codes. regards, dan carpenter > + /* set phy_addr to invalid value for fixed link */ > + macb->phy_addr =

Re: [PATCH 1/3] usb: dwc3: handle return value of clk_get_rate() correctly

2024-02-04 Thread Dan Carpenter
nux kernel's clk_get_rate() function returns zero and not error codes, btw. regards, dan carpenter

Re: [RFC PATCH v2 2/2] board: ad401: example of fastboot oem board realization

2024-02-01 Thread Dan Carpenter
ze_per_copy" or maybe some kind of limit minus the offset... > + buffer, flags); > + if (ret) > + return ret; > + } > + > + return 0; > +} regards, dan carpenter

Re: [PATCH 06/13] clk/qcom: sdm845: add USB clocks

2024-01-31 Thread Dan Carpenter
enable(priv->base + USB30_SEC_GDSCR); > + qcom_gate_clk_en(priv, GCC_USB3_SEC_PHY_AUX_CLK); > + > + qcom_gate_clk_en(priv, GCC_USB3_SEC_CLKREF_CLK); > + qcom_gate_clk_en(priv, GCC_USB3_SEC_PHY_COM_AUX_CLK); > + break; > + } regards, dan carpenter

Re: [PATCH 07/13] gpio: msm_gpio: add .set_flags op

2024-01-31 Thread Dan Carpenter
^^^ > + if (flags & GPIOD_PULL_UP) > + return msm_gpio_set_value(dev, gpio, 1); > + else if (flags & GPIOD_PULL_DOWN) > + return msm_gpio_set_value(dev, gpio, 0); These lines are unreachable code. > + } > + > + return 0; > +} regards, dan carpenter

Re: [PATCH v2 2/3] driver: rng: Fix SMCCC TRNG crash

2024-01-31 Thread Dan Carpenter
On Wed, Jan 31, 2024 at 02:48:58PM +0300, Dan Carpenter wrote: > Etienne should have been on the CC list. He's in > ./scripts/get_maintainer.pl so I'm not sure what went wrong there... > I've added him. > Hm... Etienne's @linaro.org address bounces. Apparently MAINTAINERS needs t

Re: [PATCH v2 2/3] driver: rng: Fix SMCCC TRNG crash

2024-01-31 Thread Dan Carpenter
))) > + if (!smccc || !(smccc_trng_is_supported(smccc->invoke_fn))) To me it seems a bit strange that dm_priv_to_rw() can return NULL... Anyway, probably the Fixes tag should point to when the driver was added. Fixes: 53355bb86c25 ("drivers: rng: add smccc trng driver") regards, dan carpenter

[bug report] lib: sparse: Make CHUNK_TYPE_RAW buffer aligned

2024-01-30 Thread Dan Carpenter
break; 222 223 case CHUNK_TYPE_FILL: 224 if (chunk_header->total_sz != regards, dan carpenter

[PATCH] blk: host_dev: Fix error code in host_sb_attach_file()

2024-01-30 Thread Dan Carpenter
This error path should return -EINVAL instead of success. Fixes: e261fbf34785 ("blk: host_dev: Sanity check on the size of host backing file") Signed-off-by: Dan Carpenter --- drivers/block/host_dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/host_dev.c b/dri

[PATCH] power: regulator: Fix error code in regulator_list_autoset()

2024-01-30 Thread Dan Carpenter
This condition has a bitwise & vs logical && typo so it only preserves odd number error codes. Fixes: 3b880757abca ("dm: regulator: uclass driver code cleanup") Signed-off-by: Dan Carpenter --- drivers/power/regulator/regulator-uclass.c | 2 +- 1 file changed, 1 in

[PATCH] button: qcom-pmic: fix some error checking

2024-01-30 Thread Dan Carpenter
The pmic_reg_read() function can return errors. Add a check for that. Fixes: 4e8aa0065d4b ("button: qcom-pmic: introduce Qualcomm PMIC button driver") Signed-off-by: Dan Carpenter --- This patch is mostly to make static checkers happy but it's obvious and harmless. drivers/button/b

Re: [PATCH] fsl-layerscape/soc.c: do not destroy bootcmd environment

2024-01-30 Thread Dan Carpenter
> Signed-off-by: Mike Looijmans Thanks, Mike. Fixes: 2141d250f510 ("armv8: fsl-layerscape: bootcmd identification for TFABOOT") Reviewed-by: Dan Carpenter regards, dan carpenter

Re: [PATCH v3 14/36] board: dragonboard410c: upstream DT compat

2024-01-30 Thread Dan Carpenter
phy\n", __func__); > + return -ENOENT; > + } > + > + return device_bind_driver_to_node(dev, "msm8916_usbphy", > "msm8916_usbphy", > + phy_node, NULL); > + > + return 0; Delete the extra return 0. > +} regards, dan carpenter

Re: [PATCH v3 03/36] mmc: msm_sdhci: use modern clock handling

2024-01-30 Thread Dan Carpenter
ret); > + return -EINVAL; The if statement looks reversed. Or if we want clk_set_rate() to fail then there isn't a reason to print "ret" in the error message because we know that's zero. > + } > > return 0; > } regards, dan carpenter

Re: [PATCH v10 1/8] mtd: spi-nor: Add parallel and stacked memories support

2024-01-29 Thread Dan Carpenter
buf += ret; > + if (is_ofst_odd == 1) { > + memcpy(buf, (buf + 1), (len - 1)); This needs to be memmove(). memcpy() is undefined for overlapped buffers. > + *retlen += (ret - 1); > + buf += ret - 1; > + is_ofst_odd = 0; > + } else { > + *retlen += ret; > + buf += ret; > + } > from += ret; > len -= ret; > } regards, dan carpenter

[bug report] cmd: mbr: Allow 4 MBR partitions without need for extended

2024-01-29 Thread Dan Carpenter
en(mbr_parts_p3) + 248 max(strlen(mbr_parts_p4), strlen(mbr_parts_p5)) + 249 strlen(mbr_parts_tail); 250 ut_assertf(sizeof(mbr_parts_buf) >= mbr_parts_max, "Buffer avail: %ld; buffer req: %ld\n", 251 sizeof(mbr_parts_buf),

Re: [PATCH v1 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-24 Thread Dan Carpenter
g of pre-dtb kernels (3.4 for > example) since it uses ATAGs. To fix this, pass `-` in the > fdt extlinux field as a signal that no tree should be used. Passing - doesn't seem like the most intuitive thing... Is there a different argument we could use? regards, dan carpenter

Re: [RFC PATCH v3 14/15] board: ti: am65x: Add check for k3-am654-icssg2 in board_fit_config_match()

2024-01-24 Thread Dan Carpenter
On Wed, Jan 24, 2024 at 11:27:12AM +0300, Dan Carpenter wrote: > On Wed, Jan 24, 2024 at 12:19:29PM +0530, MD Danish Anwar wrote: > > When CONFIG_TI_ICSSG_PRUETH is enabled, add config name check for the > > icssg2 overlay in board_fit_config_match() API. > > > > Sig

Re: [RFC PATCH v3 14/15] board: ti: am65x: Add check for k3-am654-icssg2 in board_fit_config_match()

2024-01-24 Thread Dan Carpenter
nfigs being enabled. if (IS_ENABLED(CONFIG_TI_ICSSG_PRUETH) && strcmp(name, "k3-am654-icssg2") == 0) return 0; if (IS_ENABLED(TARGET_AM654_A53_EVM) && strcmp(name, "k3-am654-base-board")) return 0; return -1; regards, dan carpenter

[PATCH] btrfs: fix some error checking for btrfs_decompress()

2023-08-03 Thread Dan Carpenter
The btrfs_decompress() function mostly (u32)-1 on error but it can also return -EPERM or other kernel error codes from zstd_decompress(). The "ret" variable is an int, so we could just check for negatives. Signed-off-by: Dan Carpenter --- fs/btrfs/inode.c | 4 ++-- 1 file changed, 2

Re: [PATCH] fs: btrfs: Prevent error pointer dereference in list_subvolums()

2023-08-01 Thread Dan Carpenter
so if you have static checker ideas then feel free to email the smatch mailing list. sma...@vger.kernel.org regards, dan carpenter

[PATCH] test: fix a couple NULL vs IS_ERR() checks

2023-07-31 Thread Dan Carpenter
The x509_cert_parse() and pkcs7_parse_message() functions return error pointers. They don't return NULL. Update the checks accordingly. Signed-off-by: Dan Carpenter --- test/lib/asn1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lib/asn1.c b/test/lib/asn1.c

[PATCH] expo: allocate correct ammount of memory

2023-07-31 Thread Dan Carpenter
This should be allocating the memory for "item" instead of "menu". The item struct is 48 bytes instead of 96 (assuming a 64bit system) so this saves a little memory. Signed-off-by: Dan Carpenter --- boot/scene_menu.c | 2 +- 1 file changed, 1 insertions(+), 1 deletions(-

[PATCH] cmd: improve string matching for hex

2023-07-31 Thread Dan Carpenter
Match the "=0x" instead of just "=0". Signed-off-by: Dan Carpenter --- We sometimes two character partial matching for commands so people can type "re" instead of "read". But here reading two characters doesn't seem correct. cmd/nvedit_efi.c | 2 +- 1

Re: [PATCH] addrmap: Fix off by one in addrmap_set_entry()

2023-07-27 Thread Dan Carpenter
On Wed, Jul 26, 2023 at 06:49:44PM -0600, Simon Glass wrote: > Hi Dan, > > On Tue, 25 Jul 2023 at 09:40, Dan Carpenter wrote: > > > > The > comparison needs to be changed to >= to prevent an out of bounds > > write on th next line. > > > > S

Re: [PATCH v2] efi_loader: Fix memory corruption on 32bit systems

2023-07-27 Thread Dan Carpenter
> [0] > https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf I have maybe misread something... I don't think this is a real issue. 32bit systems aren't going to be able to allocate that much memory anyway. Also there are a lot of size_t parameters already so it's not a new issue. regards, dan carpenter

Re: [PATCH] efi_loader: fix an IS_ERR() vs NULL check

2023-07-27 Thread Dan Carpenter
On Thu, Jul 27, 2023 at 11:28:52AM +0300, Ilias Apalodimas wrote: > Hi Dan, Heinrich > > On Thu, 27 Jul 2023 at 11:25, Heinrich Schuchardt wrote: > > > > On 7/27/23 09:16, Dan Carpenter wrote: > > > The efi_parse_pkcs7_header() function returns NULL on error

Re: [PATCH] efi_loader: fix an IS_ERR() vs NULL check

2023-07-27 Thread Dan Carpenter
On Thu, Jul 27, 2023 at 10:25:55AM +0200, Heinrich Schuchardt wrote: > On 7/27/23 09:16, Dan Carpenter wrote: > > The efi_parse_pkcs7_header() function returns NULL on error so the check > > for IS_ERR() should be changed to a NULL check. > > > > Signed-off-by: Dan C

[bug report] bootcount: add a new driver with syscon as backend

2023-07-27 Thread Dan Carpenter
>reg_addr, priv->reg_mask, 63 regval); 64 } regards, dan carpenter

[PATCH] efi_loader: fix an IS_ERR() vs NULL check

2023-07-27 Thread Dan Carpenter
The efi_parse_pkcs7_header() function returns NULL on error so the check for IS_ERR() should be changed to a NULL check. Signed-off-by: Dan Carpenter --- lib/efi_loader/efi_capsule.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib

[PATCH] efi_loader: fix uninitialized variable bug in efi_set_load_options()

2023-07-27 Thread Dan Carpenter
Check for efi_search_protocol() failure before dereferencing "handler" to avoid a crash. Signed-off-by: Dan Carpenter --- lib/efi_loader/efi_load_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_load_options.c b/lib/efi_loader/efi_load

[PATCH] cramfs: clean up some error messages

2023-07-27 Thread Dan Carpenter
This line break is not done correctly. We don't want to have all those tabs in the printed output. Signed-off-by: Dan Carpenter --- fs/cramfs/cramfs.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 6c017cebc50f

[PATCH] test: unicode: fix a sizeof() vs ARRAY_SIZE() bug

2023-07-27 Thread Dan Carpenter
The u16_strlcat() is in units of u16 not bytes. So the limit needs to be ARRAY_SIZE() instead of sizeof(). Signed-off-by: Dan Carpenter --- test/unicode_ut.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unicode_ut.c b/test/unicode_ut.c index b27d7116b9ee

[PATCH] cmd: pxe_utils: add some missing tabs

2023-07-27 Thread Dan Carpenter
These lines are supposed to be indented one more tab. Otherwise it's confusing to read. Signed-off-by: Dan Carpenter --- boot/pxe_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index d13c47dd9429..ac1414a5f26d 100644

[PATCH v2] efi_loader: Fix memory corruption on 32bit systems

2023-07-27 Thread Dan Carpenter
of efi_prepare_aligned_image() to a size_t pointer. Signed-off-by: Dan Carpenter --- v2: Change efi_prepare_aligned_image() instead of changing efi_image_authenticate(). This is a cleaner way to fix the problem. include/efi_loader.h | 2 +- lib/efi_loader/efi_image_loader.c | 4

Re: [PATCH] efi_loader: Fix memory corruption on 32bit systems

2023-07-26 Thread Dan Carpenter
On Wed, Jul 26, 2023 at 10:11:04AM +0300, Ilias Apalodimas wrote: > Hi Dan > > On Wed, 26 Jul 2023 at 09:55, Dan Carpenter wrote: > > > > It's pretty unlikely that anyone is going to be using EFI authentication > > on a 32bit system. However, if you did, th

[bug report] fs: fat: create correct short names

2023-07-26 Thread Dan Carpenter
3s", period_location, dirent.name, dirent.ext); 141 if (!strcmp(buf, filename)) { 142 ret = 1; regards, dan carpenter

[PATCH] regulator: preserve error code properly in regulator_list_autoset()

2023-07-26 Thread Dan Carpenter
This code has a & vs && typo so it only preserves odd value error codes and not even value error codes. Signed-off-by: Dan Carpenter --- drivers/power/regulator/regulator-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/regulator/regulator

[PATCH] remoteproc: uclass: Clean up a return

2023-07-26 Thread Dan Carpenter
We know that "pa" is non-NULL so it's nicer to just return zero instead of return !pa. This has no effect on runtime behavior. Signed-off-by: Dan Carpenter --- drivers/remoteproc/rproc-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remote

[PATCH] fdt: off by one in ofnode_lookup_fdt()

2023-07-26 Thread Dan Carpenter
The "oftree_count" is the number of entries which have been set in the oftree_list[] array. If all the entries have been initialized then this off by one would result in reading one element beyond the end of the array. Signed-off-by: Dan Carpenter --- drivers/core/ofnode.c | 2

[PATCH] fs: btrfs: Prevent error pointer dereference in list_subvolums()

2023-07-26 Thread Dan Carpenter
If btrfs_read_fs_root() fails with -ENOENT, then we go to the next entry. Fine. But if it fails for a different reason then we need to clean up and return an error code. In the current code it doesn't clean up but instead dereferences "root" and crashes. Signed-off-by: Dan Carpen

[PATCH] cros_ec: Fix an error code is cros_ec_get_sku_id()

2023-07-26 Thread Dan Carpenter
The ec_command_inptr() function returns negative error codes or the number of bytes that it was able to read. The cros_ec_get_sku_id() function should return negative error codes. Right now it returns positive error codes or negative byte counts. Signed-off-by: Dan Carpenter --- drivers/misc

[PATCH] efi_loader: Fix memory corruption on 32bit systems

2023-07-26 Thread Dan Carpenter
It's pretty unlikely that anyone is going to be using EFI authentication on a 32bit system. However, if you did, the efi_prepare_aligned_image() function would write 8 bytes of data to the _size variable and it can only hold 4 bytes so that corrupts memory. Signed-off-by: Dan Carpenter --- lib

[PATCH] video: Add parentheses around VNBYTES() macro

2023-07-26 Thread Dan Carpenter
eal. Signed-off-by: Dan Carpenter --- include/video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/video.h b/include/video.h index 9729fa348aa5..b364bf91825f 100644 --- a/include/video.h +++ b/include/video.h @@ -58,7 +58,7 @@ enum video_log2_bpp { * Convert e

[PATCH] cmd: Fix an error code in cmd_mux_find()

2023-07-25 Thread Dan Carpenter
This returns the wrong variable. It ends up returning NULL when it was suppose to return an error pointer. Signed-off-by: Dan Carpenter --- cmd/mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/mux.c b/cmd/mux.c index 833266f08b1e..c75907af7726 100644 --- a/cmd

[bug report] cros_ec: Add vstore support

2023-07-25 Thread Dan Carpenter
gt;data, slot->data, EC_VSTORE_SLOT_SIZE); 558 len = sizeof(*resp); 559 break; 560 } 561 case EC_CMD_PWM_GET_DUTY: { 562 const struct ec_params_pwm_get_duty *req = req_data; regards, dan carpenter

[PATCH] addrmap: Fix off by one in addrmap_set_entry()

2023-07-25 Thread Dan Carpenter
The > comparison needs to be changed to >= to prevent an out of bounds write on th next line. Signed-off-by: Dan Carpenter --- lib/addr_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/addr_map.c b/lib/addr_map.c index 9b3e0a544e47..86e932e4b561 100644 ---

[PATCH] cmd: Fix a size parameter in test_readonly()

2023-07-25 Thread Dan Carpenter
The parentheses are in the wrong place so this passes the number of bytes to write as "sizeof(index_0) != TPM_SUCCESS" when just "sizeof(index_0)" was intended. (1 byte vs 4 bytes). Signed-off-by: Dan Carpenter --- cmd/tpm_test.c | 4 ++-- 1 file changed, 2 insertions(+),