* [U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem @ 2018-01-02 7:25 Peng Fan 2018-01-02 7:25 ` [U-Boot] [PATCH 2/2] video: Support multiple lines version string display Peng Fan 2018-01-03 11:20 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin 0 siblings, 2 replies; 5+ messages in thread From: Peng Fan @ 2018-01-02 7:25 UTC (permalink / raw) To: u-boot The clk_set_rate function dereferences the clk pointer without checking whether it is NULL. This may cause problem when clk is NULL. Signed-off-by: Peng Fan <peng.fan@nxp.com> --- drivers/video/ipu_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c index 96229da502..b3b09e6982 100644 --- a/drivers/video/ipu_common.c +++ b/drivers/video/ipu_common.c @@ -134,6 +134,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate) { if (clk && clk->set_rate) clk->set_rate(clk, rate); + + if (!clk) + return 0; + return clk->rate; } -- 2.14.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] video: Support multiple lines version string display 2018-01-02 7:25 [U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem Peng Fan @ 2018-01-02 7:25 ` Peng Fan 2018-01-03 11:31 ` Anatolij Gustschin 2018-01-03 11:20 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin 1 sibling, 1 reply; 5+ messages in thread From: Peng Fan @ 2018-01-02 7:25 UTC (permalink / raw) To: u-boot The calculation of left space for version string is not correct, should use VIDEO_COLS not VIDEO_LINE_LEN / 2, otherwise we will get larger space than actual have and cause string to overlay logo picture. Also current version string display only supports two lines words at max. This also causes overlay when the LCD pixel colume size is not enough. Signed-off-by: Peng Fan <peng.fan@nxp.com> --- drivers/video/cfb_console.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 74cc20d653..0b25897062 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1900,16 +1900,32 @@ static void *video_logo(void) sprintf(info, " %s", version_string); #ifndef CONFIG_HIDE_LOGO_VERSION - space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH; + space = (VIDEO_COLS - VIDEO_INFO_X) / VIDEO_FONT_WIDTH; len = strlen(info); if (len > space) { - video_drawchars(VIDEO_INFO_X, VIDEO_INFO_Y, - (uchar *) info, space); - video_drawchars(VIDEO_INFO_X + VIDEO_FONT_WIDTH, - VIDEO_INFO_Y + VIDEO_FONT_HEIGHT, - (uchar *) info + space, len - space); - y_off = 1; + int xx = VIDEO_INFO_X, yy = VIDEO_INFO_Y; + uchar *p = (uchar *) info; + + while (len) { + if (len > space) { + video_drawchars(xx, yy, p, space); + len -= space; + + p = (uchar *)p + space; + + if (!y_off) { + xx += VIDEO_FONT_WIDTH; + space--; + } + yy += VIDEO_FONT_HEIGHT; + + y_off++; + } else { + video_drawchars(xx, yy, p, len); + len = 0; + } + } } else video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info); -- 2.14.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] video: Support multiple lines version string display 2018-01-02 7:25 ` [U-Boot] [PATCH 2/2] video: Support multiple lines version string display Peng Fan @ 2018-01-03 11:31 ` Anatolij Gustschin 0 siblings, 0 replies; 5+ messages in thread From: Anatolij Gustschin @ 2018-01-03 11:31 UTC (permalink / raw) To: u-boot On Tue, 2 Jan 2018 15:25:37 +0800 Peng Fan peng.fan at nxp.com wrote: > The calculation of left space for version string is not correct, should > use VIDEO_COLS not VIDEO_LINE_LEN / 2, otherwise we will get larger space > than actual have and cause string to overlay logo picture. > > Also current version string display only supports two lines words at max. > This also causes overlay when the LCD pixel colume size is not enough. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/video/cfb_console.c | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) applied to u-boot-video/master, thanks! -- Anatolij ^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem 2018-01-02 7:25 [U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem Peng Fan 2018-01-02 7:25 ` [U-Boot] [PATCH 2/2] video: Support multiple lines version string display Peng Fan @ 2018-01-03 11:20 ` Anatolij Gustschin 2018-01-03 11:33 ` Anatolij Gustschin 1 sibling, 1 reply; 5+ messages in thread From: Anatolij Gustschin @ 2018-01-03 11:20 UTC (permalink / raw) To: u-boot From: Peng Fan <peng.fan@nxp.com> The clk_set_rate function dereferences the clk pointer without checking whether it is NULL. This may cause problem when clk is NULL. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Anatolij Gustschin <agust@denx.de> --- Changes in v2: - move the NULL check to top of function drivers/video/ipu_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c index 96229da502..889085aa76 100644 --- a/drivers/video/ipu_common.c +++ b/drivers/video/ipu_common.c @@ -132,8 +132,12 @@ struct clk *clk_get_parent(struct clk *clk) int clk_set_rate(struct clk *clk, unsigned long rate) { - if (clk && clk->set_rate) + if (!clk) + return 0; + + if (clk->set_rate) clk->set_rate(clk, rate); + return clk->rate; } -- 2.11.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem 2018-01-03 11:20 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin @ 2018-01-03 11:33 ` Anatolij Gustschin 0 siblings, 0 replies; 5+ messages in thread From: Anatolij Gustschin @ 2018-01-03 11:33 UTC (permalink / raw) To: u-boot On Wed, 3 Jan 2018 12:20:49 +0100 Anatolij Gustschin agust at denx.de wrote: > From: Peng Fan <peng.fan@nxp.com> > > The clk_set_rate function dereferences the clk pointer without > checking whether it is NULL. This may cause problem when clk is NULL. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > Signed-off-by: Anatolij Gustschin <agust@denx.de> > --- > Changes in v2: > - move the NULL check to top of function > > drivers/video/ipu_common.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) applied to u-boot-video/master, thanks! -- Anatolij ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-03 11:33 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-01-02 7:25 [U-Boot] [PATCH 1/2] video: ipu: Fix dereferencing NULL pointer problem Peng Fan 2018-01-02 7:25 ` [U-Boot] [PATCH 2/2] video: Support multiple lines version string display Peng Fan 2018-01-03 11:31 ` Anatolij Gustschin 2018-01-03 11:20 ` [U-Boot] [PATCH v2 1/2] video: ipu: Fix dereferencing NULL pointer problem Anatolij Gustschin 2018-01-03 11:33 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox