<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/hwmon/applesmc.c, branch linux-4.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-09-09T17:04:23Z</updated>
<entry>
<title>hwmon: (applesmc) check status earlier.</title>
<updated>2020-09-09T17:04:23Z</updated>
<author>
<name>Tom Rix</name>
</author>
<published>2020-08-20T13:19:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb0d61385e21d231322c9f78815c2b4f967b1e84'/>
<id>urn:sha1:bb0d61385e21d231322c9f78815c2b4f967b1e84</id>
<content type='text'>
[ Upstream commit cecf7560f00a8419396a2ed0f6e5d245ccb4feac ]

clang static analysis reports this representative problem

applesmc.c:758:10: warning: 1st function call argument is an
  uninitialized value
        left = be16_to_cpu(*(__be16 *)(buffer + 6)) &gt;&gt; 2;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

buffer is filled by the earlier call

	ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...

This problem is reported because a goto skips the status check.
Other similar problems use data from applesmc_read_key before checking
the status.  So move the checks to before the use.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Reviewed-by: Henrik Rydberg &lt;rydberg@bitmath.org&gt;
Link: https://lore.kernel.org/r/20200820131932.10590-1-trix@redhat.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>dmi: Mark all struct dmi_system_id instances const</title>
<updated>2017-09-14T09:59:30Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2017-09-14T09:59:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6faadbbb7f9da70ce484f98f72223c20125a1009'/>
<id>urn:sha1:6faadbbb7f9da70ce484f98f72223c20125a1009</id>
<content type='text'>
... and __initconst if applicable.

Based on similar work for an older kernel in the Grsecurity patch.

[JD: fix toshiba-wmi build]
[JD: add htcpen]
[JD: move __initconst where checkscript wants it]

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jean Delvare &lt;jdelvare@suse.de&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Avoid buffer overruns</title>
<updated>2017-07-15T23:38:56Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2017-07-12T03:53:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1009ccdc64ee2c8451f76b548589f6b989d13412'/>
<id>urn:sha1:1009ccdc64ee2c8451f76b548589f6b989d13412</id>
<content type='text'>
gcc 7.1 complains that the driver uses sprintf() and thus does not validate
the length of output buffers.

drivers/hwmon/applesmc.c: In function 'applesmc_show_fan_position':
drivers/hwmon/applesmc.c:82:21: warning:
	'%d' directive writing between 1 and 5 bytes into a region of size 4

Fix the problem by using scnprintf() instead of sprintf() throughout the
driver. Also explicitly limit the number of supported fans to avoid actual
buffer overruns and thus invalid keys.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon : (applesmc) Fix uninitialized variables warnings</title>
<updated>2015-11-16T05:52:39Z</updated>
<author>
<name>Shuah Khan</name>
</author>
<published>2015-11-05T22:39:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5e0a0ee4d397665e5a509ed03ed9c41727c5f228'/>
<id>urn:sha1:5e0a0ee4d397665e5a509ed03ed9c41727c5f228</id>
<content type='text'>
Fix the following "maybe used uninitialized" warnings by
initializing the variables to keep the compiler quiet.
There is no "used uninitialized" in this case.

  CC [M]  drivers/hwmon/applesmc.o
drivers/hwmon/applesmc.c: In function ‘applesmc_init_smcreg’:
drivers/hwmon/applesmc.c:595:43: warning: ‘right_light_sensor’
may be used uninitialized in this function [-Wmaybe-uninitialized]
  s-&gt;num_light_sensors = left_light_sensor + right_light_sensor;
                                           ^
drivers/hwmon/applesmc.c:540:26: note: ‘right_light_sensor’ was
declared here
  bool left_light_sensor, right_light_sensor;
                          ^
drivers/hwmon/applesmc.c:595:43: warning: ‘left_light_sensor’ may
be used uninitialized in this function [-Wmaybe-uninitialized]
  s-&gt;num_light_sensors = left_light_sensor + right_light_sensor;
                                           ^
drivers/hwmon/applesmc.c:540:7: note: ‘left_light_sensor’ was
declared here
  bool left_light_sensor, right_light_sensor;
       ^

Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: applesmc: fix comment typos</title>
<updated>2015-09-29T13:28:01Z</updated>
<author>
<name>Bastien Nocera</name>
</author>
<published>2015-09-10T12:46:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0c6cac7ab44435d8837931a561cc4d58530cc032'/>
<id>urn:sha1:0c6cac7ab44435d8837931a561cc4d58530cc032</id>
<content type='text'>
s/ressources/resources/

Signed-off-by: Bastien Nocera &lt;hadess@hadess.net&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>hwmon: drop owner assignment from platform_drivers</title>
<updated>2014-10-20T14:20:36Z</updated>
<author>
<name>Wolfram Sang</name>
</author>
<published>2014-10-20T14:20:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2a1ed077189a38bccf39cb00d8dca96d20a49463'/>
<id>urn:sha1:2a1ed077189a38bccf39cb00d8dca96d20a49463</id>
<content type='text'>
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Always read until end of data</title>
<updated>2013-10-09T16:48:55Z</updated>
<author>
<name>Henrik Rydberg</name>
</author>
<published>2013-10-02T17:15:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=25f2bd7f5add608c1d1405938f39c96927b275ca'/>
<id>urn:sha1:25f2bd7f5add608c1d1405938f39c96927b275ca</id>
<content type='text'>
The crash reported and investigated in commit 5f4513 turned out to be
caused by a change to the read interface on newer (2012) SMCs.

Tests by Chris show that simply reading the data valid line is enough
for the problem to go away. Additional tests show that the newer SMCs
no longer wait for the number of requested bytes, but start sending
data right away.  Apparently the number of bytes to read is no longer
specified as before, but instead found out by reading until end of
data. Failure to read until end of data confuses the state machine,
which eventually causes the crash.

As a remedy, assuming bit0 is the read valid line, make sure there is
nothing more to read before leaving the read function.

Tested to resolve the original problem, and runtested on MBA3,1,
MBP4,1, MBP8,2, MBP10,1, MBP10,2. The patch seems to have no effect on
machines before 2012.

Tested-by: Chris Murphy &lt;chris@cmurf.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Check key count before proceeding</title>
<updated>2013-09-26T10:48:43Z</updated>
<author>
<name>Henrik Rydberg</name>
</author>
<published>2013-09-26T06:33:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5f4513864304672e6ea9eac60583eeac32e679f2'/>
<id>urn:sha1:5f4513864304672e6ea9eac60583eeac32e679f2</id>
<content type='text'>
After reports from Chris and Josh Boyer of a rare crash in applesmc,
Guenter pointed at the initialization problem fixed below. The patch
has not been verified to fix the crash, but should be applied
regardless.

Reported-by: &lt;jwboyer@fedoraproject.org&gt;
Suggested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: checkpatch cleanup: Replace printk with pr_debug or dev_dbg as appropriate</title>
<updated>2013-04-08T04:16:38Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2013-01-10T13:49:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=692fe501da4b851cbb60edc672679ad1b41e1602'/>
<id>urn:sha1:692fe501da4b851cbb60edc672679ad1b41e1602</id>
<content type='text'>
Cc: Hans de Goede &lt;hdegoede@redhat.com&gt;
Cc: Alistair John Strachan &lt;alistair@devzero.co.uk&gt;
Cc: Henrik Rydberg &lt;rydberg@euromail.se&gt;
Acked-by: Alistair John Strachan &lt;alistair@devzero.co.uk&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Add missing inclusions of &lt;linux/err.h&gt;</title>
<updated>2012-10-10T13:25:56Z</updated>
<author>
<name>Jean Delvare</name>
</author>
<published>2012-10-10T13:25:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fa845740cbc565d8f52c32973bb598743eb0d995'/>
<id>urn:sha1:fa845740cbc565d8f52c32973bb598743eb0d995</id>
<content type='text'>
These drivers use IS_ERR so they should include &lt;linux/err.h&gt;.

Signed-off-by: Jean Delvare &lt;khali@linux-fr.org&gt;
Acked-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Acked-by: Luca Tettamanti &lt;kronos.it@gmail.com&gt;
Cc: Henrik Rydberg &lt;rydberg@euromail.se&gt;
</content>
</entry>
</feed>
