Re: [PATCH v4 3/4] powercap/drivers/dtpm: Add API for dynamic thermal power management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 12/2/20 12:37 PM, Lukasz Luba wrote:
Hi Daniel,

I realized small issue when I went through this new mutex code
(which is safer IMHO).

On 12/1/20 7:28 PM, Daniel Lezcano wrote:

[snip]

+int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent)
+{
+    struct powercap_zone *pcz;
+
+    if (!pct)
+        return -EAGAIN;
+
+    if (root && !parent)
+        return -EBUSY;
+
+    if (!root && parent)
+        return -EINVAL;
+
+    if (parent && parent->ops)
+        return -EINVAL;
+

Maybe it worth to add a check of dtpm pointer here, just to play safe?

     if (!dtpm)
         return -EINVAL;

The dtpm->ops might explode when we don't capture this miss-usage during
reviews of future drivers/shim layers. What do you think?


+    if (dtpm->ops && !(dtpm->ops->set_power_uw &&
+               dtpm->ops->get_power_uw &&
+               dtpm->ops->release))
+        return -EINVAL;
+

I am going to stress test the whole series with hotplug today
and add review for patch 4/4.


I have tested with a hotplug stress and looks OK with the mutex.
You can add again the tag:

Tested-by: Lukasz Luba <lukasz.luba@xxxxxxx>

Regards,
Lukasz



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux