Skip to contentSkip to conversation

thunderbolt: Remove superfluous check

PATCH In review Bernat, Yehezkel 4 participants 7 messages Aug 15, 2017 – Aug 30, 2017 Thunderbolt driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 thunderbolt: Remove superfluous check

The key size is tested by hex2bin() already (as '\0' isn't an hex digit)

---
 drivers/thunderbolt/switch.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/thunderbolt/switch.c +0 -3
index e9391bb..69fde0b 100644
@@ -808,9 +808,6 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr,
 	u8 key[TB_SWITCH_KEY_SIZE];
 	ssize_t ret = count;
 
-	if (count < 64)
-		return -EINVAL;
-
 	if (hex2bin(key, buf, sizeof(key)))
 		return -EINVAL;
 
Signature · 1 line
2.7.4
#6 lore raw
In reply to Bernat, Yehezkel
Quoted 1 line · Yehezkel

The key size is tested by hex2bin() already (as '\0' isn't an hex digit)

Yes, and it's guaranteed (by kernelfs) that '\0' will be there sooner or later.

Quoted 1 line

I'm using @linux.intel.com, though for this tag it really doesn't matter.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 7 lines · Mika Westerberg
Quoted 6 lines · Mika Westerberg
Quoted 4 lines · Yehezkel

The key size is tested by hex2bin() already (as '\0' isn't an hex digit)

Quoted 6 lines
Quoted 1 line

Hi Greg,

Do you have any comments regarding these patches? If not could you take them to your char-misc tree?

Will do, thanks.

greg k-h

#4 lore raw
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Mika Westerberg
Quoted 9 lines · Mika Westerberg
Quoted 6 lines · Yehezkel

The key size is tested by hex2bin() already (as '\0' isn't an hex digit)

Quoted 8 lines
Quoted 5 lines

Hi Greg,

Do you have any comments regarding these patches? If not could you take
them to your char-misc tree?

Will do, thanks.

greg k-h

Hi Greg,

I'm not sure if you intended to do so anyway, but I think it worth adding to v4.13, as these are fixes (and somewhat security related).

Thanks,
Yehezkel

#5 lore raw
Quoted 18 lines · Yehezkel
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Mika Westerberg
Quoted 9 lines · Mika Westerberg
Quoted 6 lines · Yehezkel

The key size is tested by hex2bin() already (as '\0' isn't an hex digit)

Hi Greg,

Do you have any comments regarding these patches? If not could you take
them to your char-misc tree?

Quoted 8 lines
Quoted 3 lines

Will do, thanks.

greg k-h

Hi Greg,

I'm not sure if you intended to do so anyway, but I think it worth adding to v4.13, as these are fixes (and somewhat security related).

I didn't intend to, it's a bit late for 4.13, if you think these should be backported, let [email protected] know the git commit ids when they land in Linus's tree, and I'll be glad to backport them.

thanks,

greg k-h