mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: giorgio.nicole@arcor.de
Cc: barebox@lists.infradead.org
Subject: Re: problem configuring backlight brightness levels in device tree
Date: Wed, 13 Jul 2016 07:18:05 +0200	[thread overview]
Message-ID: <20160713051805.GZ20657@pengutronix.de> (raw)
In-Reply-To: <1745635830.58889.1468237871081.JavaMail.ngmail@webmail22.arcor-online.net>

On Mon, Jul 11, 2016 at 01:51:11PM +0200, giorgio.nicole@arcor.de wrote:
> Hi,
> 
> I was trying to configure a pwm backlight on an embedded arm board
> and I think I've found a minor problem.
> 
> In the source file 'drivers/video/backlight-pwm.c', in the function pwm_backlight_parse_dt()
> you set the number of brightness values to:
> 
> pwm_backlight->backlight.brightness_max = length / sizeof(u32);
> 
> and then loop through the array with:
> 
> for (i = 0; i <=  pwm_backlight->backlight.brightness_max; i++)
> 
> to find the max of the array.
> 
> I think the '<=' should be a '<' otherwise you access an uninitialized value
> one past the end of the array; this actually does not directly crash barebox
> but the whole brightness values are scaled wrong.

Yes, you're right. Can you send a patch for this?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-07-13  5:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 11:51 giorgio.nicole
2016-07-13  5:18 ` Sascha Hauer [this message]
2016-07-14 14:17   ` [PATCH 0/4] fixes some problems found in the backligth-pwm implementation iw3gtf
2016-07-14 14:17     ` [PATCH 1/4] video/backlight-pwm: fixed a loop index going out of range iw3gtf
2016-07-14 14:17     ` [PATCH 2/4] video/backlight-pwm: fix the value of 'brightness_max' iw3gtf
2016-07-14 14:17     ` [PATCH 3/4] video/backlight-pwm: code readability improvement iw3gtf
2016-07-14 14:17     ` [PATCH 4/4] video/backlight-pwm: properly handle the case of an empty 'brightness-levels' in the device tree iw3gtf
2016-07-15  6:07     ` [PATCH 0/4] fixes some problems found in the backligth-pwm implementation Sascha Hauer
2016-07-25  8:37     ` Sascha Hauer
2016-07-11 12:24 problem configuring backlight brightness levels in device tree iw3gtf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160713051805.GZ20657@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=giorgio.nicole@arcor.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox