Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: sm501: Avoid implicit sign extension

Suspicious implicit sign extension where 'reg' (unsigned char) is
promoted in reg << clksrc to int, then sign-extended to unsigned
long. If reg << clksrc is greater than 0x7FFFFFFF, the upper bits
of the result will all be 1.

Signed-off-by: Lee Jones <lee.jones@linaro.org>

Lee Jones 5f114ebc 8a012ff9

+1 -1
+1 -1
drivers/mfd/sm501.c
··· 514 514 unsigned long mode = smc501_readl(sm->regs + SM501_POWER_MODE_CONTROL); 515 515 unsigned long gate = smc501_readl(sm->regs + SM501_CURRENT_GATE); 516 516 unsigned long clock = smc501_readl(sm->regs + SM501_CURRENT_CLOCK); 517 - unsigned char reg; 518 517 unsigned int pll_reg = 0; 519 518 unsigned long sm501_freq; /* the actual frequency achieved */ 519 + u64 reg; 520 520 521 521 struct sm501_clock to; 522 522