summaryrefslogtreecommitdiff
path: root/net/rose/rose_route.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 17:08:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 17:08:55 +0300
commit81bd6aab35ad9ecce95dfe3e33c807effe370d83 (patch)
tree6c856cb948d3bc12246f696b209a410ae138d52f /net/rose/rose_route.c
parenta681e6559ce6fe8ca56333f7041d0a0d38aaee94 (diff)
parent1562d948232546cfad45a1beddc70fe0c7b34950 (diff)
downloadlinux-rolling-stable.tar.xz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/rose/rose_route.c')
-rw-r--r--net/rose/rose_route.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index 2dd6bd3a3011..b72bf8a08d48 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -497,22 +497,15 @@ void rose_rt_device_down(struct net_device *dev)
t = rose_node;
rose_node = rose_node->next;
- for (i = 0; i < t->count; i++) {
+ for (i = t->count - 1; i >= 0; i--) {
if (t->neighbour[i] != s)
continue;
t->count--;
- switch (i) {
- case 0:
- t->neighbour[0] = t->neighbour[1];
- fallthrough;
- case 1:
- t->neighbour[1] = t->neighbour[2];
- break;
- case 2:
- break;
- }
+ memmove(&t->neighbour[i], &t->neighbour[i + 1],
+ sizeof(t->neighbour[0]) *
+ (t->count - i));
}
if (t->count <= 0)