From 785b857d99b3cd89576c280cfa3a8349c2fb7f4c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 16 Sep 2021 10:59:12 +0200 Subject: scripts/mailmapper: enable running with Python 3 Our mailmapper script required Python 2 which is no longer maintained. A main difference when converting to Python 3 is that byte strings are not character strings. So add conversion and skip over conversion errors. Signed-off-by: Heinrich Schuchardt --- scripts/mailmapper | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/mailmapper b/scripts/mailmapper index 2e2d7faff57..0e744ec1a0b 100755 --- a/scripts/mailmapper +++ b/scripts/mailmapper @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2014, Masahiro Yamada @@ -89,9 +89,10 @@ output = {} for line in shortlog.splitlines(): # tmp, mail = line.rsplit(None, 1) is not safe # because weird email addresses might include whitespaces - tmp, mail = line.split('<') - mail = '<' + mail.rstrip() try: + line = line.decode("utf-8") + tmp, mail = line.split('<') + mail = '<' + mail.rstrip() _, name = tmp.rstrip().split(None, 1) except ValueError: # author name is empty @@ -100,8 +101,11 @@ for line in shortlog.splitlines(): # another name for the same email address prev_name = mail_vs_name[mail] # Take the name with more commits - major_name = sorted([prev_name, name], - key=lambda x: commits_per_name[x] if x else 0)[1] + try: + major_name = sorted([prev_name, name], + key=lambda x: commits_per_name[x] if x else 0)[1] + except: + continue mail_vs_name[mail] = major_name if commits_per_name[major_name] > MIN_COMMITS: output[mail] = major_name -- cgit v1.2.3 From 4c3e84784849660f0c0d29e15d6c75b96c4f7f3d Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 22 Sep 2021 11:02:26 +0200 Subject: mtd: remove SPEAr flash driver st_smi Remove the driver st_smic.c used in SPEAr products and the associated config CONFIG_ST_SMI; this driver is no more used in U-Boot after the commit 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr support"). Fixes: 570c3dcfc153 ("arm: Remove spear600 boards and the rest of SPEAr support") Signed-off-by: Patrick Delaunay Reviewed-by: Stefan Roese Reviewed-by: Tom Rini --- scripts/config_whitelist.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index ff24ab18731..a9c2380d17e 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1427,7 +1427,6 @@ CONFIG_STM32_FLASH CONFIG_STV0991 CONFIG_STV0991_HZ CONFIG_STV0991_HZ_CLOCK -CONFIG_ST_SMI CONFIG_SXNI855T CONFIG_SYSFS CONFIG_SYSMGR_ISWGRP_HANDOFF -- cgit v1.2.3 From 81386ed40590bf746849ce1a1d3a2edd869bad84 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Mon, 27 Sep 2021 14:22:01 +0300 Subject: scripts: ensure the cocci script for miiphy_register does not leave NULL-unterminated strings strncpy() simply bails out when copying a source string whose size exceeds the destination string size, potentially leaving the destination string unterminated. One possible way to address is to pass MDIO_NAME_LEN - 1 and a previously zero-initialized destination string, but this is more difficult to maintain. The chosen alternative is to use strlcpy(), which properly limits the copy len in the (srclen >= size) case to "size - 1", and which is also more efficient than the strncpy() byte-by-byte implementation by using memcpy. The destination string returned by strlcpy() is always NULL terminated. Signed-off-by: Vladimir Oltean --- scripts/coccinelle/net/mdio_register.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/coccinelle/net/mdio_register.cocci b/scripts/coccinelle/net/mdio_register.cocci index 100f1029361..31a40360f99 100644 --- a/scripts/coccinelle/net/mdio_register.cocci +++ b/scripts/coccinelle/net/mdio_register.cocci @@ -16,7 +16,7 @@ identifier readfunc, writefunc; - miiphy_register(devname, readfunc, writefunc); + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) return -ENOMEM; -+ strncpy(mdiodev->name, devname, MDIO_NAME_LEN); ++ strlcpy(mdiodev->name, devname, MDIO_NAME_LEN); + mdiodev->read = readfunc; + mdiodev->write = writefunc; + -- cgit v1.2.3 From 4df9f5e39fb224a4857c3411b4cbe419e4d339e8 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Mon, 27 Sep 2021 14:22:05 +0300 Subject: scripts: ensure the cocci script for miiphy_register does not leak the MDIO bus When mdio_register fails, mdio_free should be called on the mdiodev that was previously allocated with mdio_alloc. Signed-off-by: Vladimir Oltean --- scripts/coccinelle/net/mdio_register.cocci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/coccinelle/net/mdio_register.cocci b/scripts/coccinelle/net/mdio_register.cocci index 31a40360f99..7d11281f467 100644 --- a/scripts/coccinelle/net/mdio_register.cocci +++ b/scripts/coccinelle/net/mdio_register.cocci @@ -21,7 +21,7 @@ identifier readfunc, writefunc; + mdiodev->write = writefunc; + + retval = mdio_register(mdiodev); -+ if (retval < 0) return retval; ++ if (retval < 0) { mdio_free(mdiodev); return retval; } @ update_read_sig @ identifier mii_reg.readfunc; -- cgit v1.2.3