lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 22 May 2013 14:54:13 +0200
From:	Daniel Lezcano <daniel.lezcano@...aro.org>
To:	Lu Jingchang-B35083 <B35083@...escale.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"john.stultz@...aro.org" <john.stultz@...aro.org>,
	"tglx@...utronix.de" <tglx@...utronix.de>,
	"shawn.guo@...aro.org" <shawn.guo@...aro.org>,
	"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>
Subject: Re: [PATCH v4] clocksource: add Vybrid Family pit timer support

On 05/22/2013 11:47 AM, Lu Jingchang-B35083 wrote:
> 

[ ... ]

>>
>>> +}
>>> +
>>> +static void __init pit_timer_init(struct device_node *np) {
>>> +	struct clk *pit_clk;
>>> +	void __iomem *timer_base;
>>> +	int irq;
>>> +
>>> +	timer_base = of_iomap(np, 0);
>>> +	BUG_ON(!timer_base);
>>
>> You raise a bug and then you go ahead setting up the address with an
>> invalid value, leading to a random crash.
> [Lu Jingchang-B35083] 
> The BUG_ON() will call BUG() if condition is true. It will print the stack trace and the current process will die, it won't go ahead, won't it? Thanks! 

Pff, right. I just puzzled myself. Never mind.


>>> +	/*
>>> +	 * PIT0 and PIT1 can be chained to build a 64-bit timer,
>>> +	 * so choose PIT2 as clocksource, PIT3 as clockevent device,
>>> +	 * and leave PIT0 and PIT1 unused for anyone else who needs them.
>>> +	 */
>>> +	clksrc_base = timer_base + PITn_OFFSET(2);
>>> +	clkevt_base = timer_base + PITn_OFFSET(3);
>>> +
>>> +	irq = irq_of_parse_and_map(np, 0);
>>> +
>>> +	pit_clk = of_clk_get(np, 0);
>>> +	BUG_ON(IS_ERR(pit_clk));
>>> +
>>> +	BUG_ON(clk_prepare_enable(pit_clk));
>>
>> Same here.
>>
>>> +	cycle_per_jiffy = clk_get_rate(pit_clk)/(HZ);
>>> +
>>> +	/* enable the pit module */
>>> +	__raw_writel(~PITMCR_MDIS, timer_base + PITMCR);
>>> +
>>> +	BUG_ON(pit_clocksource_init(pit_clk));
>>> +
>>> +	pit_clockevent_init(pit_clk, irq);
>>
>> Please, remove these BUG_ON, this is inconsistent especially with a one
>> call init function. If pit_timer_init can't be initialized, just pr_err
>> + BUG.
> [Lu Jingchang-B35083] 
> Do you mean that I should not use the BUG_ON or I need print an error information by pr_err before BUG. Thanks!

Actually, my initial comment was wrong, so you can ignore it.

Thank
  -- Daniel

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ