Merge "net: stmmac: Add NULL pointer dereference checks"
This commit is contained in:
commit
8014132cd9
2 changed files with 27 additions and 14 deletions
|
|
@ -351,8 +351,10 @@ static int qcom_ethqos_add_ipv6addr(struct ip_params *ip_info,
|
|||
struct net *net = dev_net(dev);
|
||||
/*For valid IPv6 address*/
|
||||
|
||||
if (!net || !net->genl_sock || !net->genl_sock->sk_socket)
|
||||
if (!net || !net->genl_sock || !net->genl_sock->sk_socket) {
|
||||
ETHQOSERR("Sock is null, unable to assign ipv6 address\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (!net->ipv6.devconf_dflt) {
|
||||
ETHQOSERR("ipv6.devconf_dflt is null, schedule wq\n");
|
||||
|
|
@ -1840,17 +1842,25 @@ static ssize_t read_phy_reg_dump(struct file *file, char __user *user_buf,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct qcom_ethqos *ethqos = file->private_data;
|
||||
struct platform_device *pdev;
|
||||
struct net_device *dev;
|
||||
struct stmmac_priv *priv;
|
||||
unsigned int len = 0, buf_len = 2000;
|
||||
char *buf;
|
||||
ssize_t ret_cnt;
|
||||
int phydata = 0;
|
||||
int i = 0;
|
||||
|
||||
struct platform_device *pdev = ethqos->pdev;
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
struct stmmac_priv *priv = netdev_priv(dev);
|
||||
if (!ethqos) {
|
||||
ETHQOSERR("NULL Pointer\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!ethqos || !dev->phydev) {
|
||||
pdev = ethqos->pdev;
|
||||
dev = platform_get_drvdata(pdev);
|
||||
priv = netdev_priv(dev);
|
||||
|
||||
if (!dev->phydev) {
|
||||
ETHQOSERR("NULL Pointer\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1884,15 +1894,22 @@ static ssize_t read_rgmii_reg_dump(struct file *file,
|
|||
loff_t *ppos)
|
||||
{
|
||||
struct qcom_ethqos *ethqos = file->private_data;
|
||||
struct platform_device *pdev;
|
||||
struct net_device *dev;
|
||||
unsigned int len = 0, buf_len = 2000;
|
||||
char *buf;
|
||||
ssize_t ret_cnt;
|
||||
int rgmii_data = 0;
|
||||
struct platform_device *pdev = ethqos->pdev;
|
||||
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
if (!ethqos) {
|
||||
ETHQOSERR("NULL Pointer\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!ethqos || !dev->phydev) {
|
||||
pdev = ethqos->pdev;
|
||||
dev = platform_get_drvdata(pdev);
|
||||
|
||||
if (!dev->phydev) {
|
||||
ETHQOSERR("NULL Pointer\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,18 +32,14 @@ static DECLARE_WAIT_QUEUE_HEAD(avb_class_b_msg_wq);
|
|||
|
||||
static int strlcmp(const char *s, const char *t, size_t n)
|
||||
{
|
||||
int ret;
|
||||
|
||||
while (n-- && *t != '\0') {
|
||||
if (*s != *t) {
|
||||
ret = ((unsigned char)*s - (unsigned char)*t);
|
||||
n = 0;
|
||||
return ((unsigned char)*s - (unsigned char)*t);
|
||||
} else {
|
||||
++s, ++t;
|
||||
ret = (unsigned char)*s;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return (unsigned char)*s;
|
||||
}
|
||||
|
||||
static u32 pps_config_sub_second_increment(void __iomem *ioaddr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue