[PATCH] gpu:drm:radeon:fix array out fo bouds

2016-05-15 Thread Heloise NH
From: tom will 

When the initial value of i is greater than zero,
it may cause endless loop, resulting in array out
of bouds, fix it.

Signed-off-by: tom will 
---
 drivers/gpu/drm/radeon/kv_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index d024074..a7e9786 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2164,7 +2164,7 @@ static void kv_apply_state_adjust_rules(struct 
radeon_device *rdev,
if (pi->caps_stable_p_state) {
stable_p_state_sclk = (max_limits->sclk * 75) / 100;
 
-   for (i = table->count - 1; i >= 0; i++) {
+   for (i = table->count - 1; i >= 0; i--) {
if (stable_p_state_sclk >= table->entries[i].clk) {
stable_p_state_sclk = table->entries[i].clk;
break;
-- 
2.1.0




[PATCH] gpu:drm:radeon:fix array out fo bouds

2016-05-15 Thread Heloise NH
From: tom will 

When the initial value of i is greater than zero,
it may cause endless loop, resulting in array out
of bouds, fix it.

Signed-off-by: tom will 
---
 drivers/gpu/drm/radeon/kv_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index d024074..a7e9786 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2164,7 +2164,7 @@ static void kv_apply_state_adjust_rules(struct 
radeon_device *rdev,
if (pi->caps_stable_p_state) {
stable_p_state_sclk = (max_limits->sclk * 75) / 100;
 
-   for (i = table->count - 1; i >= 0; i++) {
+   for (i = table->count - 1; i >= 0; i--) {
if (stable_p_state_sclk >= table->entries[i].clk) {
stable_p_state_sclk = table->entries[i].clk;
break;
-- 
2.1.0




[PATCH] fix return value error

2015-10-14 Thread Heloise NH
Signed-off-by: Heloise NH 
---
 drivers/infiniband/hw/ipath/ipath_fs.c | 2 +-
 drivers/infiniband/hw/qib/qib_fs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c 
b/drivers/infiniband/hw/ipath/ipath_fs.c
index 25422a3..da753bc 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -53,7 +53,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
diff --git a/drivers/infiniband/hw/qib/qib_fs.c 
b/drivers/infiniband/hw/qib/qib_fs.c
index 13ef22b..a4c5a6a 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -55,7 +55,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fix return value error

2015-10-14 Thread Heloise NH
Signed-off-by: Heloise NH 
---
 drivers/infiniband/hw/ipath/ipath_fs.c | 2 +-
 drivers/infiniband/hw/qib/qib_fs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c 
b/drivers/infiniband/hw/ipath/ipath_fs.c
index 25422a3..da753bc 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -53,7 +53,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
diff --git a/drivers/infiniband/hw/qib/qib_fs.c 
b/drivers/infiniband/hw/qib/qib_fs.c
index 13ef22b..a4c5a6a 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -55,7 +55,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fix return value error

2015-10-14 Thread Heloise NH
Signed-off-by: Heloise NH <o...@iscas.ac.cn>
---
 drivers/infiniband/hw/ipath/ipath_fs.c | 2 +-
 drivers/infiniband/hw/qib/qib_fs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c 
b/drivers/infiniband/hw/ipath/ipath_fs.c
index 25422a3..da753bc 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -53,7 +53,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
diff --git a/drivers/infiniband/hw/qib/qib_fs.c 
b/drivers/infiniband/hw/qib/qib_fs.c
index 13ef22b..a4c5a6a 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -55,7 +55,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fix return value error

2015-10-14 Thread Heloise NH
Signed-off-by: Heloise NH <o...@iscas.ac.cn>
---
 drivers/infiniband/hw/ipath/ipath_fs.c | 2 +-
 drivers/infiniband/hw/qib/qib_fs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c 
b/drivers/infiniband/hw/ipath/ipath_fs.c
index 25422a3..da753bc 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -53,7 +53,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
diff --git a/drivers/infiniband/hw/qib/qib_fs.c 
b/drivers/infiniband/hw/qib/qib_fs.c
index 13ef22b..a4c5a6a 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -55,7 +55,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry 
*dentry,
struct inode *inode = new_inode(dir->i_sb);
 
if (!inode) {
-   error = -EPERM;
+   error = -ENOMEM;
goto bail;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] trace-event-python.c used malloc without checking ptr if NULL

2015-09-29 Thread Heloise NH
Signed-off-by: Heloise NH 
---
 tools/perf/util/scripting-engines/trace-event-python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/scripting-engines/trace-event-python.c 
b/tools/perf/util/scripting-engines/trace-event-python.c
index cff58ae..14d8e73 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -475,7 +475,7 @@ static int python_start_script(const char *script, int 
argc, const char **argv)
FILE *fp;
 
command_line = malloc((argc + 1) * sizeof(const char *));
-   if (command_line == NULL){
+   if (command_line == NULL) {
err = -1;
goto error;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] trace-event-python.c used malloc without checking ptr if NULL

2015-09-29 Thread Heloise NH
Signed-off-by: Heloise NH <o...@iscas.ac.cn>
---
 tools/perf/util/scripting-engines/trace-event-python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/scripting-engines/trace-event-python.c 
b/tools/perf/util/scripting-engines/trace-event-python.c
index cff58ae..14d8e73 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -475,7 +475,7 @@ static int python_start_script(const char *script, int 
argc, const char **argv)
FILE *fp;
 
command_line = malloc((argc + 1) * sizeof(const char *));
-   if (command_line == NULL){
+   if (command_line == NULL) {
err = -1;
goto error;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ALSA: hda: fix kstrdup return value

2015-07-16 Thread Heloise NH
From: kernelpatch_update 

In kstrdup we should return -ENOMEM when it reports an 
memory allocation failure, while the -ENODEV is referred
to a failure in finding the cpu node in the device tree.

Signed-off-by: Heloise NH 
---
 sound/pci/hda/hda_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 5de3c5d..d78fa71 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -975,7 +975,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card 
*card,
if (codec->bus->modelname) {
codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
if (!codec->modelname) {
-   err = -ENODEV;
+   err = -ENOMEM;
goto error;
}
}
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ALSA: hda: fix kstrdup return value

2015-07-16 Thread Heloise NH
From: kernelpatch_update kernelpatch_upd...@163.com

In kstrdup we should return -ENOMEM when it reports an 
memory allocation failure, while the -ENODEV is referred
to a failure in finding the cpu node in the device tree.

Signed-off-by: Heloise NH kernelpatch_upd...@163.com
---
 sound/pci/hda/hda_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 5de3c5d..d78fa71 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -975,7 +975,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card 
*card,
if (codec-bus-modelname) {
codec-modelname = kstrdup(codec-bus-modelname, GFP_KERNEL);
if (!codec-modelname) {
-   err = -ENODEV;
+   err = -ENOMEM;
goto error;
}
}
-- 
1.9.1


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/