diff for duplicates of <20200714082516.GZ2571@kadam> diff --git a/a/1.txt b/N1/1.txt index ef7c78c..986ae16 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -4,11 +4,11 @@ On Tue, Jul 14, 2020 at 03:39:13AM +0200, Roland Scheidegger wrote: > > list_for_each_entry() loops without hitting a break statement but they > > don't work. > > -> > In the first loop, we increment "i" after the "if (i = unit)" condition +> > In the first loop, we increment "i" after the "if (i == unit)" condition > > so we don't necessarily know that "i" is not equal to unit at the end of > > the loop. > So, if I understand this right, this would only really be a problem if -> there's no list entries at all, right? That is i = unit = 0. +> there's no list entries at all, right? That is i == unit == 0. > Not sure if that can actually happen, but in any case the fix looks correct. An empty list and there is another potential issue where unit is exactly @@ -16,10 +16,10 @@ off by one. list_for_each_entry(con, &dev_priv->dev->mode_config.connector_list, head) { - if (i = unit) + if (i == unit) break; ++i; <-- this is the last iteration and it's off by one - so now i = unit but we didn't exit via the + so now i == unit but we didn't exit via the break statement. } @@ -35,3 +35,8 @@ Technically correct is the best kind of correct! ;) regards, dan carpenter + +_______________________________________________ +dri-devel mailing list +dri-devel@lists.freedesktop.org +https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/a/content_digest b/N1/content_digest index 9a62188..b9a0c71 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -2,7 +2,7 @@ "ref\077f0761a-11e6-e321-2245-700258d54924@vmware.com\0" "From\0Dan Carpenter <dan.carpenter@oracle.com>\0" "Subject\0Re: [PATCH] drm/vmwgfx: Fix two list_for_each loop exit tests\0" - "Date\0Tue, 14 Jul 2020 08:25:16 +0000\0" + "Date\0Tue, 14 Jul 2020 11:25:16 +0300\0" "To\0Roland Scheidegger <sroland@vmware.com>\0" "Cc\0David Airlie <airlied@linux.ie>" kernel-janitors@vger.kernel.org @@ -16,11 +16,11 @@ "> > list_for_each_entry() loops without hitting a break statement but they\n" "> > don't work.\n" "> > \n" - "> > In the first loop, we increment \"i\" after the \"if (i = unit)\" condition\n" + "> > In the first loop, we increment \"i\" after the \"if (i == unit)\" condition\n" "> > so we don't necessarily know that \"i\" is not equal to unit at the end of\n" "> > the loop.\n" "> So, if I understand this right, this would only really be a problem if\n" - "> there's no list entries at all, right? That is i = unit = 0.\n" + "> there's no list entries at all, right? That is i == unit == 0.\n" "> Not sure if that can actually happen, but in any case the fix looks correct.\n" "\n" "An empty list and there is another potential issue where unit is exactly\n" @@ -28,10 +28,10 @@ "\n" "\tlist_for_each_entry(con, &dev_priv->dev->mode_config.connector_list,\n" "\t\t\t head) {\n" - "\t\tif (i = unit)\n" + "\t\tif (i == unit)\n" "\t\t\tbreak;\n" "\t\t++i; <-- this is the last iteration and it's off by one\n" - "\t\t\t so now i = unit but we didn't exit via the\n" + "\t\t\t so now i == unit but we didn't exit via the\n" "\t\t\t break statement.\n" "\t}\n" "\n" @@ -46,6 +46,11 @@ "Technically correct is the best kind of correct! ;)\n" "\n" "regards,\n" - dan carpenter + "dan carpenter\n" + "\n" + "_______________________________________________\n" + "dri-devel mailing list\n" + "dri-devel@lists.freedesktop.org\n" + https://lists.freedesktop.org/mailman/listinfo/dri-devel -4157b4e0c922f9ba42795b580adb1028ae365810bb3351cca44de92e1c297915 +b95ab42fc31e4f8d7d8698955c0d7c6cc1eb13093f81b1ff33f789e790b49496
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.