Re: [RFC PATCH] bcache: fix stack corruption by PRECEDING_KEY()

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

 



Hi Coly, Rolf,

I think Rolf is right, with his second option (*preceding_key_p = ZERO_KEY;)

Regards,

Le 08/06/2019 à 20:50, Rolf Fokkens a écrit :
On 6/8/19 12:22 PM, Coly Li wrote:
+static inline void preceding_key(struct bkey *k, struct bkey *preceding_key_p)
+{
+    if (KEY_INODE(k) || KEY_OFFSET(k)) {
+        *preceding_key_p = KEY(KEY_INODE(k), KEY_OFFSET(k), 0);
+        if (!preceding_key_p->low)
+            preceding_key_p->high--;
+        preceding_key_p->low--;
+    } else {
+        preceding_key_p = NULL;

If I'm correct, the line above has no net effect, it just changes a local variable (parameter) with no effect elsewhere. So the else part may be left out, or do you mean this?

*preceding_key_p = ZERO_KEY;

+    }
+}
    static inline bool bch_ptr_invalid(struct btree_keys *b, const struct bkey *k)
  {







[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux