diff mbox

media: pt1: fix strncmp() size warning

Message ID 5ebaf32866b649cc4e384725ce2742d705c064e6.1525520023.git.mchehab+samsung@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab May 5, 2018, 11:33 a.m. UTC
As warned by smatch:
	drivers/media/pci/pt1/pt1.c:213 config_demod() error: strncmp() '"tc90522sat"' too small (11 vs 20)

Use the same strncmp() syntax as pt1_init_frontends() does.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/pci/pt1/pt1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko May 5, 2018, 11:38 a.m. UTC | #1
On Sat, May 5, 2018 at 2:33 PM, Mauro Carvalho Chehab
<mchehab+samsung@kernel.org> wrote:
> As warned by smatch:
>         drivers/media/pci/pt1/pt1.c:213 config_demod() error: strncmp() '"tc90522sat"' too small (11 vs 20)
>
> Use the same strncmp() syntax as pt1_init_frontends() does.

> +       is_sat = !strncmp(cl->name, TC90522_I2C_DEV_SAT,
> +                         strlen(TC90522_I2C_DEV_SAT));

In this case I don't see a point to use strNcmp(). Plain strcmp() would work.
diff mbox

Patch

diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c
index a3126d7caac7..3b7e08a4639a 100644
--- a/drivers/media/pci/pt1/pt1.c
+++ b/drivers/media/pci/pt1/pt1.c
@@ -210,7 +210,8 @@  static int config_demod(struct i2c_client *cl, enum pt1_fe_clk clk)
 		return ret;
 	usleep_range(30000, 50000);
 
-	is_sat = !strncmp(cl->name, TC90522_I2C_DEV_SAT, I2C_NAME_SIZE);
+	is_sat = !strncmp(cl->name, TC90522_I2C_DEV_SAT,
+			  strlen(TC90522_I2C_DEV_SAT));
 	if (is_sat) {
 		struct i2c_msg msg[2];
 		u8 wbuf, rbuf;